Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to fix on navigation to back page having screen flickering issue #522

Open
AlicyberMeteors opened this issue Jul 9, 2024 · 1 comment
Labels
question Further information is requested

Comments

@AlicyberMeteors
Copy link

AlicyberMeteors commented Jul 9, 2024

Type question here.
When navigate to previous sceen for a moment screen flickers

this is my code
HtmlEditor(
otherOptions: OtherOptions( decoration: BoxDecoration(border: Border.all(color: const Color(0xffA8AEBF)),borderRadius: BorderRadius.circular(15))),
controller: htmlEditorController,
callbacks: Callbacks(
onChangeContent: (text) {
setState(() {
htmlDescription=text!;
debugPrint("debug text $htmlDescription");
debugPrint("HtmlEditor content changed");
});
},
),
htmlEditorOptions: HtmlEditorOptions(
adjustHeightForKeyboard: true,
autoAdjustHeight: true,
initialText: htmlDescription,
hint: 'Your text here...',
shouldEnsureVisible: false,

                ),
                htmlToolbarOptions: const HtmlToolbarOptions(
                  toolbarPosition: ToolbarPosition.aboveEditor, //by default
                  defaultToolbarButtons: [
                    FontButtons(bold: true,clearAll: false,subscript: false,strikethrough: false,superscript: false),
                    FontSettingButtons(fontSizeUnit: false,fontName: false,),
                    ColorButtons(),
                    ListButtons(listStyles: false),
                    ParagraphButtons(textDirection: false, lineHeight: false, caseConverter: false,decreaseIndent: false,increaseIndent: false,),
                  ],
                  toolbarType: ToolbarType.nativeScrollable, //by default
                ),

              ),

and having this error
AndroidInAppWebViewWidget calling "dispose" using []
D/ConnectivityManager(23317): StackLog: [android.net.ConnectivityManager.unregisterNetworkCallback(ConnectivityManager.java:5075)] [org.chromium.net.a.h(chromium-TrichromeWebViewGoogle6432.aab-stable-647813433:17)] [WV.P7.a(chromium-TrichromeWebViewGoogle6432.aab-stable-647813433:3)] [org.chromium.android_webview.AwContentsLifecycleNotifier.onLastWebViewDestroyed(chromium-TrichromeWebViewGoogle6432.aab-stable-647813433:22)] [J.N.MQGusfGb(Native Method)] [WV.s6.run(chromium-TrichromeWebViewGoogle6432.aab-stable-647813433:3)] [WV.kd.handleMessage(chromium-TrichromeWebViewGoogle6432.aab-stable-647813433:55)] [WV.md.a(chromium-TrichromeWebViewGoogle6432.aab-stable-647813433:25)] [org.chromium.android_webview.AwContents.k(chromium-TrichromeWebViewGoogle6432.aab-stable-647813433:33)] [WV.c6.run(chromium-TrichromeWebViewGoogle6432.aab-stable-647813433:20)]
D/ConnectivityManager(23317): StackLog: [android.net.ConnectivityManager.unregisterNetworkCallback(ConnectivityManager.java:5075)] [org.chromium.net.a.h(chromium-TrichromeWebViewGoogle6432.aab-stable-647813433:26)] [WV.P7.a(chromium-TrichromeWebViewGoogle6432.aab-stable-647813433:3)] [org.chromium.android_webview.AwContentsLifecycleNotifier.onLastWebViewDestroyed(chromium-TrichromeWebViewGoogle6432.aab-stable-647813433:22)] [J.N.MQGusfGb(Native Method)] [WV.s6.run(chromium-TrichromeWebViewGoogle6432.aab-stable-647813433:3)] [WV.kd.handleMessage(chromium-TrichromeWebViewGoogle6432.aab-stable-647813433:55)] [WV.md.a(chromium-TrichromeWebViewGoogle6432.aab-stable-647813433:25)] [org.chromium.android_webview.AwContents.k(chromium-TrichromeWebViewGoogle6432.aab-stable-647813433:33)] [WV.c6.run(chromium-TrichromeWebViewGoogle6432.aab-stable-647813433:20)]
E/chromium(23317): [ERROR:aw_browser_terminator.cc(166)] Renderer process (9514) crash detected (code -1).

@AlicyberMeteors AlicyberMeteors added the question Further information is requested label Jul 9, 2024
@amabilee
Copy link

amabilee commented Nov 5, 2024

The flickering issue when navigating back might be due to the HtmlEditor's disposal process or screen rendering when it reloads. I cant say for sure whats the problem, but you can check these:

  1. Check the dispose Method: Make sure the htmlEditorController is properly disposed when the widget is removed.
  2. Avoid Frequent setState Calls: Calling setState on every onChangeContent can be resource-intensive and could contribute to flickering, especially if the editor is frequently updating
  3. Cache the Editor State: To avoid reloading the editor from scratch when navigating back, you could use a PageStorageKey to store the editor’s state.
  4. If you’re using InAppWebView or something similar under the hood, setting cacheMode: WebSettings.LOAD_CACHE_ELSE_NETWORK in the WebView might help reduce flickering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants