Closed daohoangson closed 5 months ago
We already use something like this in our controller. Maybe that will help.
static const String _javaScriptChannel = 'ContentHeight';
static const String _sizeReportingJavaScript = '''
const resizeObserver = new ResizeObserver(entries =>
$_javaScriptChannel.postMessage(entries[0].target.scrollHeight)
)
resizeObserver.observe(document.documentElement)
''';
controller.addJavaScriptChannel(
_javaScriptChannel,
onMessageReceived: _setContentHeight,
);
Thank you for the suggestion, @DFelten. I think the implementation will look very similar to that.
Just FYI, the latest version (v0.15.1
) has been released with the new auto resize logic.
We are using timers to perform size evaluations and resize the web view. For slow web pages, it is not reliable / slow to react. It would be better if we can use JavaScript channel and listen to the window
resize
event.Should wait for #1138 to stabilize the test executions before attempting this.
See: