daohoangson / flutter_widget_from_html

Flutter package to render html as widgets that supports hyperlink, image, audio, video, iframe and many other tags.
https://pub.dev/packages/flutter_widget_from_html
MIT License
635 stars 235 forks source link

Crash on Android device #375

Closed liyao20190808 closed 3 years ago

liyao20190808 commented 3 years ago

I/WebViewFactory(27108): Loading com.google.android.webview version 86.0.4240.185 (code 424018503) I/cr_LibraryLoader(27108): Loaded native library version number "86.0.4240.185" I/cr_CachingUmaRecorder(27108): Flushed 5 samples from 5 histograms. W/beyondsoft.HRM(27108): Accessing hidden method Landroid/content/Context;->bindServiceAsUser(Landroid/content/Intent;Landroid/content/ServiceConnection;ILandroid/os/Handler;Landroid/os/UserHandle;)Z (light greylist, reflection) E/chromium(27108): [ERROR:filesystem_posix.cc(62)] mkdir /data/user/0/[package name]/cache/WebView/Crashpad: No such file or directory (2) D/HwCustConnectivityManagerImpl(27108): isBlockNetworkRequestByNonAis, INVALID_SUBSCRIPTION_ID D/ConnectivityManager(27108): requestNetwork and the calling app is: [package name] D/HwCustConnectivityManagerImpl(27108): isBlockNetworkRequestByNonAis, INVALID_SUBSCRIPTION_ID W/beyondsoft.HRM(27108): Accessing hidden method Landroid/media/AudioManager;->getOutputLatency(I)I (light greylist, reflection) V/AudioManager(27108): isWiredHeadsetOn... W/cr_media(27108): Requires BLUETOOTH permission I/HwPhoneWindow(27108): updateLayoutParamsColor false mSpecialSet=false, mForcedNavigationBarColor=false, navigationBarColor=0, mNavBarShow=false, mIsFloating=false I/HwPhoneWindow(27108): updateLayoutParamsColor true mSpecialSet=false, mForcedNavigationBarColor=false, navigationBarColor=ff000000, mNavBarShow=false, mIsFloating=false D/OpenGLRenderer(27108): HWUI Binary is enabled D/OpenGLRenderer(27108): disableOutlineDraw is true I/HiTouch_HiTouchSensor(27108): HiTouch restricted: Sub windows restricted. D/HiTouch_PressGestureDetector(27108): onAttached, package=[package name], windowType=2030, mHiTouchRestricted=true D/mali_winsys(27108): EGLint new_window_surface(egl_winsys_display , void , EGLSurface, EGLConfig, egl_winsys_surface , EGLBoolean) returns 0x3000 D/OpenGLRenderer(27108): HWUI Binary is enabled D/OpenGLRenderer(27108): disableOutlineDraw is true W/beyondsoft.HRM(27108): Accessing hidden field Ljava/nio/Buffer;->address:J (light greylist, reflection) I/chromium(27108): [INFO:CONSOLE(1)] "%c I/chromium(27108): // I/chromium(27108): \ // I/chromium(27108): \ // I/chromium(27108): ##DDDDDDDDDDDDDDDDDDDDDD## I/chromium(27108): ## DDDDDDDDDDDDDDDDDDDD ## ____ ____ I/chromium(27108): ## hh hh ## |\ \ |\ \ |\ \ |\ \ |\ \ |\ \ |\ \ |\ \ I/chromium(27108): ## hh // \ hh ## \ \ |\ /\ \ \ \ \ \ \ \ \ |\ /\ \ \ \ \ \ \ \ I/chromium(27108): ## hh // \ hh ## \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ I/chromium(27108): ## hh hh ## \ \ |\ \ \ \ \ _ \ \ \ \ |\ \ \ \ \ __ \ \ \ I/chromium(27108): ## hh wwww hh ## \ __\ __\ ___\ __\ ___\ __\ ___\ __\ I/chromium(27108): ## hh hh ## |_| |_| || || || || || |__| I/chromium(27108): ## MMMMMMMMMMMMMMMMMMMM ## I/chromium(27108): ##MMMMMMMMMMMMMMMMMMMMMM## Release 1.0.0. Powered by jinkela-core 2.8.4. I/chromium(27108): \/ \/ color:#00a1d6", source: https://s1.hdslb.com/bfs/static/jinkela/mstation-h5/mstation.2985c127de4949d4f32ee921103dccce1d47730a.js (1) W/PlatformViewsController(27108): Creating a virtual display of size: [640, 1882] may result in problems(https://github.com/flutter/flutter/issues/2897).It is larger than the device screen size: [720, 1204]. I/HwPhoneWindow(27108): updateLayoutParamsColor false mSpecialSet=false, mForcedNavigationBarColor=false, navigationBarColor=0, mNavBarShow=false, mIsFloating=false I/HwPhoneWindow(27108): updateLayoutParamsColor true mSpecialSet=false, mForcedNavigationBarColor=false, navigationBarColor=ff000000, mNavBarShow=false, mIsFloating=false D/OpenGLRenderer(27108): HWUI Binary is enabled D/OpenGLRenderer(27108): disableOutlineDraw is true W/libEGL (27108): EGLNativeWindowType 0x745249e010 disconnect failed I/HiTouch_HiTouchSensor(27108): HiTouch restricted: Sub windows restricted. D/HiTouch_PressGestureDetector(27108): onAttached, package=[package name], windowType=2037, mHiTouchRestricted=true D/mali_winsys(27108): EGLint new_window_surface(egl_winsys_display , void , EGLSurface, EGLConfig, egl_winsys_surface , EGLBoolean) returns 0x3000 D/OpenGLRenderer(27108): HWUI Binary is enabled D/OpenGLRenderer(27108): disableOutlineDraw is true W/PlatformViewsController(27108): Creating a virtual display of size: [640, 2666] may result in problems(https://github.com/flutter/flutter/issues/2897).It is larger than the device screen size: [720, 1204]. I/HwPhoneWindow(27108): updateLayoutParamsColor false mSpecialSet=false, mForcedNavigationBarColor=false, navigationBarColor=0, mNavBarShow=false, mIsFloating=false I/HwPhoneWindow(27108): updateLayoutParamsColor true mSpecialSet=false, mForcedNavigationBarColor=false, navigationBarColor=ff000000, mNavBarShow=false, mIsFloating=false E/Surface (27108): queueBuffer: error queuing buffer to SurfaceTexture, -19 W/OpenGLRenderer(27108): swapBuffers encountered 12291, EGL_BAD_ALLOC D/OpenGLRenderer(27108): HWUI Binary is enabled D/OpenGLRenderer(27108): disableOutlineDraw is true I/HiTouch_HiTouchSensor(27108): HiTouch restricted: Sub windows restricted. D/HiTouch_PressGestureDetector(27108): onAttached, package=[package name], windowType=2037, mHiTouchRestricted=true D/mali_winsys(27108): EGLint new_window_surface(egl_winsys_display , void , EGLSurface, EGLConfig, egl_winsys_surface , EGLBoolean) returns 0x3000 D/OpenGLRenderer(27108): HWUI Binary is enabled D/OpenGLRenderer(27108): disableOutlineDraw is true W/PlatformViewsController(27108): Creating a virtual display of size: [640, 3452] may result in problems(https://github.com/flutter/flutter/issues/2897).It is larger than the device screen size: [720, 1204]. I/HwPhoneWindow(27108): updateLayoutParamsColor false mSpecialSet=false, mForcedNavigationBarColor=false, navigationBarColor=0, mNavBarShow=false, mIsFloating=false I/HwPhoneWindow(27108): updateLayoutParamsColor true mSpecialSet=false, mForcedNavigationBarColor=false, navigationBarColor=ff000000, mNavBarShow=false, mIsFloating=false E/Surface (27108): queueBuffer: error queuing buffer to SurfaceTexture, -19 W/OpenGLRenderer(27108): swapBuffers encountered 12291, EGL_BAD_ALLOC D/OpenGLRenderer(27108): HWUI Binary is enabled D/OpenGLRenderer(27108): disableOutlineDraw is true I/chromium(27108): [INFO:CONSOLE(2)] "SW registered: [object ServiceWorkerRegistration]", source: https://s1.hdslb.com/bfs/static/jinkela/long/js/sentry/sentry-5.6.3.min.js (2) I/HiTouch_HiTouchSensor(27108): HiTouch restricted: Sub windows restricted. D/HiTouch_PressGestureDetector(27108): onAttached, package=[package name], windowType=2037, mHiTouchRestricted=true D/mali_winsys(27108): EGLint new_window_surface(egl_winsys_display , void , EGLSurface, EGLConfig, egl_winsys_surface , EGLBoolean) returns 0x3000 D/OpenGLRenderer(27108): HWUI Binary is enabled D/OpenGLRenderer(27108): disableOutlineDraw is true I/chromium(27108): [INFO:CONSOLE(2)] "[Websocket]: On Open.", source: https://s1.hdslb.com/bfs/static/jinkela/long/js/sentry/sentry-5.6.3.min.js (2) I/flutter (27108): [HtmlWidget] onTapUrl(bilibili://video/797556720?h5awaken=cHZpZD01MjYwRTg0OC02QjBCLUREOEUtMjg3NC0zRUM3RDkxNzk5NjkwNTQ0NWluZm9jXzc5NzU1NjcyMF8xNjA1NjA1OTA3ODE0JnVhPU1vemlsbGElMkY1LjAlMjAoTGludXglM0IlMjBBbmRyb2lkJTIwOSUzQiUyMERVSy1BTDIwJTIwQnVpbGQlMkZIVUFXRUlEVUstQUwyMCUzQiUyMHd2KSUyMEFwcGxlV2ViS2l0JTJGNTM3LjM2JTIwKEtIVE1MJTJDJTIwbGlrZSUyMEdlY2tvKSUyMFZlcnNpb24lMkY0LjAlMjBDaHJvbWUlMkY4Ni4wLjQyNDAuMTg1JTIwTW9iaWxlJTIwU2FmYXJpJTJGNTM3LjM2JmlzQXV0b09wZW49dHJ1ZSZic291cmNlPXVuZGVmaW5lZCYmb3Blbl9hcHBfZnJvbV90eXBlPWg1Jm9wZW5fYXBwX3V1aWQ9MDgyMjMxNUQtMDcxRC03RUJBLUQwQTctM0YyQzBCMTU3REQ5MDY0ODdpbmZvYyZvcGVuX2FwcF9ncm91cGlkPSU3QiU3RCZvcGVuX2FwcF91cmw9aHR0cHMlM0ElMkYlMkZtLmJpbGliaWxpLmNvbSUyRnZpZGVvJTJGQlYxQnk0eTFyN1Q3Jm9wZW5fYXBwX2FkZGl0aW9uPSU3QiUyMnNwbWlkJTIyJTNBJTIyMzMzLjQwMS5jbGljay5hdXRvT3BlbkFwcCUyMiUyQyUyMmdyb3VwX2lkJTIyJTNBNSUyQyUyMmJzb3VyY2UlMjIlM0ElMjJkZWZhdWx0JTIyJTJDJTIydW5pcXVlX2slMjIlM0FudWxsJTJDJTIyc2Vzc2lvbklkJTIyJTNBJTIyNjcwdmFnOXR6cmswJTIyJTdE&page=0) couldn't launch W/PlatformViewsController(27108): Creating a virtual display of size: [640, 4236] may result in problems(https://github.com/flutter/flutter/issues/2897).It is larger than the device screen size: [720, 1204]. I/HwPhoneWindow(27108): updateLayoutParamsColor false mSpecialSet=false, mForcedNavigationBarColor=false, navigationBarColor=0, mNavBarShow=false, mIsFloating=false I/HwPhoneWindow(27108): updateLayoutParamsColor true mSpecialSet=false, mForcedNavigationBarColor=false, navigationBarColor=ff000000, mNavBarShow=false, mIsFloating=false D/OpenGLRenderer(27108): HWUI Binary is enabled D/OpenGLRenderer(27108): disableOutlineDraw is true E/MethodChannel#flutter/platform_views(27108): Failed to handle method call E/MethodChannel#flutter/platform_views(27108): java.lang.RuntimeException: InputChannel is not initialized. E/MethodChannel#flutter/platform_views(27108): at android.view.InputEventReceiver.nativeInit(Native Method) E/MethodChannel#flutter/platform_views(27108): at android.view.InputEventReceiver.(InputEventReceiver.java:78) E/MethodChannel#flutter/platform_views(27108): at android.view.ViewRootImpl$WindowInputEventReceiver.(ViewRootImpl.java:7984) E/MethodChannel#flutter/platform_views(27108): at android.view.ViewRootImpl.setView(ViewRootImpl.java:983) E/MethodChannel#flutter/platform_views(27108): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:398) E/MethodChannel#flutter/platform_views(27108): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:131) E/MethodChannel#flutter/platform_views(27108): at android.app.Dialog.show(Dialog.java:536) E/MethodChannel#flutter/platform_views(27108): at android.app.Presentation.show(Presentation.java:249) E/MethodChannel#flutter/platform_views(27108): at io.flutter.plugin.platform.VirtualDisplayController.resize(VirtualDisplayController.java:161) E/MethodChannel#flutter/platform_views(27108): at io.flutter.plugin.platform.PlatformViewsController$1.resizePlatformView(PlatformViewsController.java:285) E/MethodChannel#flutter/platform_views(27108): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.resize(PlatformViewsChannel.java:138) E/MethodChannel#flutter/platform_views(27108): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:65) E/MethodChannel#flutter/platform_views(27108): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233) E/MethodChannel#flutter/platform_views(27108): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85) E/MethodChannel#flutter/platform_views(27108): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692) E/MethodChannel#flutter/platform_views(27108): at android.os.MessageQueue.nativePollOnce(Native Method) E/MethodChannel#flutter/platform_views(27108): at android.os.MessageQueue.next(MessageQueue.java:386) E/MethodChannel#flutter/platform_views(27108): at android.os.Looper.loop(Looper.java:175) E/MethodChannel#flutter/platform_views(27108): at android.app.ActivityThread.main(ActivityThread.java:7625) E/MethodChannel#flutter/platform_views(27108): at java.lang.reflect.Method.invoke(Native Method) E/MethodChannel#flutter/platform_views(27108): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524) E/MethodChannel#flutter/platform_views(27108): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987) W/OpenGLRenderer(27108): Failed to set damage region on surface 0x7438560680, error=EGL_BAD_ACCESS W/OpenGLRenderer(27108): swapBuffers encountered EGL error 12301 on 0x7438560680, halting rendering... I/HiTouch_HiTouchSensor(27108): HiTouch restricted: Sub windows restricted. D/HiTouch_PressGestureDetector(27108): onAttached, package=[package name], windowType=2037, mHiTouchRestricted=true E/flutter (27108): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: PlatformException(error, InputChannel is not initialized., null, java.lang.RuntimeException: InputChannel is not initialized. E/flutter (27108): at android.view.InputEventReceiver.nativeInit(Native Method) E/flutter (27108): at android.view.InputEventReceiver.(InputEventReceiver.java:78) E/flutter (27108): at android.view.ViewRootImpl$WindowInputEventReceiver.(ViewRootImpl.java:7984) E/flutter (27108): at android.view.ViewRootImpl.setView(ViewRootImpl.java:983) E/flutter (27108): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:398) E/flutter (27108): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:131) E/flutter (27108): at android.app.Dialog.show(Dialog.java:536) E/flutter (27108): at android.app.Presentation.show(Presentation.java:249) E/flutter (27108): at io.flutter.plugin.platform.VirtualDisplayController.resize(VirtualDisplayController.java:161) E/flutter (27108): at io.flutter.plugin.platform.PlatformViewsController$1.resizePlatformView(PlatformViewsController.java:285) E/flutter (27108): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.resize(PlatformViewsChannel.java:138) E/flutter (27108): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:65) E/flutter (27108): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233) E/flutter (27108): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85) E/flutter (27108): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:692) E/flutter (27108): at android.os.MessageQueue.nativePollOnce(Native Method) E/flutter (27108): at android.os.MessageQueue.next(MessageQueue.java:386) E/flutter (27108): at android.os.Looper.loop(Looper.java:175) E/flutter (27108): at android.app.ActivityThread.main(ActivityThread.java:7625) E/flutter (27108): at java.lang.reflect.Method.invoke(Native Method) E/flutter (27108): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524) E/flutter (27108): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987) E/flutter (27108): ) E/flutter (27108): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:582:7) E/flutter (27108): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:159:18) E/flutter (27108): E/flutter (27108): #2 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:332:12) E/flutter (27108): #3 TextureAndroidViewController.setSize (package:flutter/src/services/platform_views.dart:1005:41) E/flutter (27108): #4 RenderAndroidView._sizePlatformView (package:flutter/src/rendering/platform_view.dart:174:29) E/flutter (27108): #5 RenderAndroidView.performResize (package:flutter/src/rendering/platform_view.dart:155:5) E/flutter (27108): #6 RenderObject.layout (package:flutter/src/rendering/object.dart:1756:9) E/flutter (27108): #7 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:113:14) E/flutter (27108): #8 RenderObject.layout (package:flutter/src/rendering/object.dart:1777:7) E/flutter (27108): #9 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:113:14) E/flutter (27108): #10 RenderObject.layout (package:flutter/src/rendering/object.dart:1777:7) E/flutter (27108): #11 RenderAspectRatio.performLayout (package:flutter/src/rendering/proxy_box.dart:528:14) E/flutter (27108): #12 RenderObject.layout (package:flutter/src/rendering/object.dart:1777:7) E/flutter (27108): #13 RenderFlex.performLayout (package:flutter/src/rendering/flex.dart:768:15) E/flutter (27108): #14 RenderObject.layout (package:flutter/src/rendering/object.dart:1777:7) E/flutter (27108): #15 RenderFlex.performLayout (package:flutter/src/rendering/flex.dart:768:15) E/flutter (27108): #16 RenderObject.layout (package:flutter/src/rendering/object.dart:1777:7) E/flutter (27108): #17 RenderPadding.performLayout (package:flutter/src/rendering/shifted_box.dart:207:12) E/flutter (27108): #18 RenderObject.layout (package:flutter/src/rendering/object.dart:1777:7) E/flutter (27108): #19 _RenderSingleChildViewport.performLayout (package:flutter/src/widgets/single_child_scroll_view.dart:549:13) E/flutter (27108): #20 RenderObject.layout (package:flutter/src/rendering/object.dart:1777:7) E/flutter (27108): #21 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:113:14) E/flutter (27108): #22 RenderObject.layout (package:flutter/src/rendering/object.dart:1777:7) E/flutter (27108): #23 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:113:14) E/flutter (27108): #24 RenderObjec E/AndroidRuntime(27008): FATAL EXCEPTION: highpool[2] E/AndroidRuntime(27008): Process: com.google.android.gms, PID: 27008 E/AndroidRuntime(27008): DeadSystemException: The system died; earlier logs will point to the root cause I/Choreographer(27108): Skipped 42 frames! The application may be doing too much work on its main thread. W/Sensors (27108): sensorservice died [0x740c01cf00] D/AndroidRuntime(27108): Shutting down VM W/beyondsoft.HRM(27108): Accessing hidden method Lcom/msic/qarth/PatchStore;->createDisableExceptionQarthFile(Ljava/lang/Throwable;)Z (blacklist, JNI) E/beyondsoft.HRM(27108): [qarth_debug:] get PatchStore::createDisableExceptionQarthFile method fail. E/AndroidRuntime(27108): FATAL EXCEPTION: main E/AndroidRuntime(27108): Process: [package name], PID: 27108 E/AndroidRuntime(27108): DeadSystemException: The system died; earlier logs will point to the root cause

daohoangson commented 3 years ago

Do you have a HTML with IFRAME before it crashed? Did you tap on a link? Also, what is your Android version?

liyao20190808 commented 3 years ago

@override // ignore: must_call_super Widget build(BuildContext context) { return Scaffold( appBar: new AppBar( title: Text( 'Announcement', style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, fontSize: 25.0), ), brightness: Brightness.light, backgroundColor: Theme.of(context).primaryColor, centerTitle: true, leading: InkWell( child: Icon( Icons.arrow_back_ios, color: Colors.white, ), onTap: () => NavigatorUtils.goBack(context), ), ), body: _announcementDetail == null ? Container() : SingleChildScrollView( physics: BouncingScrollPhysics(), child: Padding( padding: const EdgeInsets.all(20.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( _announcementDetail.subject, style: TextStyle( color: Colors.black, fontSize: 18.0, fontWeight: FontWeight.w500), ), SizedBox(height: 20.0), HtmlWidget( // the first parameter (html) is required '''${_htmlString}''', buildAsync: true, // set the default styling for text textStyle: TextStyle(fontSize: 14), // By default, webView is turned off because additional config // must be done for PlatformView to work on iOS. // https://pub.flutter-io.cn/packages/webview_flutter#ios // Make sure you have it configured before using. webView: true, ) ], ) ), )); }

and the html string is:

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.


Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.


Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.



https://github.com/daohoangson/flutter_widget_from_html/


Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.




liyao20190808 commented 3 years ago

Do you have a HTML with IFRAME before it crashed? Did you tap on a link? Also, what is your Android version?

Yes,I do. I do not tap anything and it happens when loading html, freezed and then crashed. Android 9.0

liyao20190808 commented 3 years ago

D:\develop\flutter>flutter doctor -v [√] Flutter (Channel stable, 1.22.4, on Microsoft Windows [Version 10.0.18363.1198], locale zh-CN) • Flutter version 1.22.4 at D:\develop\flutter • Framework revision 1aafb3a8b9 (4 days ago), 2020-11-13 09:59:28 -0800 • Engine revision 2c956a31c0 • Dart version 2.10.4

pubspec.yaml: flutter_widget_from_html: ^0.5.1+5

daohoangson commented 3 years ago

I'm unable to reproduce this on my device but it looks like a bug with the official webview plugin as reported here https://github.com/flutter/flutter/issues/45243. I'm not sure what can be done here...

DFelten commented 3 years ago

The bug appears because on Android it's not allowed to create large WebViews within ScrollViews. We've found that there can be problems as soon as the WebView is larger than the screen height on Android. So we calculate the height via JavaScript and set a max height for the WebView within the HTML content to the calculated height like this:

final double webViewHeight = Platform.isAndroid ? min(contentHeight, screenHeight) : contentHeight;

Significantly larger WebViews with JavaScript are outsourced as ModalBottomSheet and only the WebView is added there. Instead of the WebView a button is displayed in the HTML content.

daohoangson commented 3 years ago
final double webViewHeight = Platform.isAndroid ? min(contentHeight, screenHeight) : contentHeight;

I think this is a good temporary workaround until Flutter team fixes the web view. I'll add it to the next release.

DFelten commented 3 years ago

An alternative would be to enable hybrid composition for the WebView on Android. Then the crash is also gone, but it's extremly laggy on Android 9 and lower.

if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView();

liyao20190808 commented 3 years ago

I'm unable to reproduce this on my device but it looks like a bug with the official webview plugin as reported here flutter/flutter#45243. I'm not sure what can be done here...

When loading html (especially the video part), scrolling down will cause the page to get stuck and then crash.

Sunbreak commented 3 years ago

@DFelten An alternative would be to enable hybrid composition for the WebView on Android. Then the crash is also gone, but it's extremly laggy on Android 9 and lower.

if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView();

Is there any video or device info? We're investigating improvement

daohoangson commented 3 years ago

@Sunbreak more information regarding WebView in ListView on Android is available here https://github.com/flutter/flutter/issues/45243