webview_flutter_plus
webview_flutter_plus copied to clipboard
Error when loading from dataFromString and not url
I have the following issue when using the plugin:
W/System (17063): A resource failed to call release. W/System (17063): A resource failed to call release. W/PlatformViewsController(17063): Creating a virtual display of size: [1080, 6675] may result in problems(https://github.com/flutter/flutter/issues/2897).It is larger than the device screen size: [1080, 1884]. E/InputMethodManager(17063): b/117267690: Failed to get fallback IMM with expected displayId=37 actual IMM#displayId=0 view=io.flutter.plugins.webviewflutter.InputAwareWebView{6511e40 VFEDHVC.. ........ 0,0-1080,6675} I/chromium(17063): [INFO:CONSOLE(123)] "Uncaught ReferenceError: jQuery is not defined", source: E/InputMethodManager(17063): b/117267690: Failed to get fallback IMM with expected displayId=37 actual IMM#displayId=0 view=io.flutter.plugins.webviewflutter.InputAwareWebView{6511e40 VFEDHVC.. ........ 0,0-1080,6675} E/chromium(17063): [ERROR:aw_browser_terminator.cc(125)] Renderer process (28337) crash detected (code -1).
And this is my implementation:
SizedBox(
height: _containerHeight,
child: WebViewPlus(
onWebViewCreated: (controller) {
controller = controller;
controller.loadUrl(Uri.dataFromString(widget.articleModel.body,
mimeType: 'text/html',
encoding: Encoding.getByName('utf-8'))
.toString());
},
onPageFinished: (url) {
controller.getHeight().then((double height) {
print("Height: " + height.toString());
setState(() {
_containerHeight = height;
});
});
},
javascriptMode: JavascriptMode.unrestricted,
),
);
The widget.articleModel.body does not contain any html or body tags, it's just paragraph tags
I think the problem is not that you load data from a string, instead the problem is a WebView with a too large height. In Android it crashes when the height of the WebView is too high.
Currently I've got the same problem and searching for a solution. More information in this issue.