You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I am using an html editor to write description for a product, now the thing is, it works fine when the html editor is empty (default initialisation) when I use it in my Add Product Page but when I navigate to the Edit product page and try to assign a value to html editor it throws an exception.
Unhandled Exception: Looking up a deactivated widget's ancestor is unsafe.
At this point the state of the widget's element tree is no longer stable.
To safely refer to a widget's ancestor in its dispose() method, save a reference to the ancestor by calling dependOnInheritedWidgetOfExactType() in the widget's didChangeDependencies() method.
#0 Element._debugCheckStateIsActiveForAncestorLookup. (package:flutter/src/widgets/framework.dart:4153:9) #1 Element._debugCheckStateIsActiveForAncestorLookup (package:flutter/src/widgets/framework.dart:4167:6) #2 Element.dependOnInheritedWidgetOfExactType (package:flutter/src/widgets/framework.dart:4182:12) #3 Theme.of (package:flutter/src/material/theme.dart:107:53) #4 _HtmlEditorWidgetMobileState.build. (package:html_editor_enhanced/src/widgets/html_editor_widget_mobile.dart:456:34)
To Reproduce
this is my onInit function for the html editor (descriptionField is the controller for this html editor) (descriptionResult is the variable that contains raw string, the data to be shown in this html editor)
var descriptionResult = "<p>daaaaaaaaaaaaaaaaaaaaaaaaaa</p>";
It does the job right but it slows down the App and it throws this exception
Screenshots
Device:
I am using a simulator and an iPhoneX for testing purposes
If you need the entire code or explanation I am all for it but I've been trying to resolve this issue for a while and I just can't figure this one out.
The text was updated successfully, but these errors were encountered:
Okay, So after soooo many days I've tried to resolve it by commenting the part // if ((Theme.of(context).brightness == Brightness.dark || // widget.htmlEditorOptions.darkMode == true) && // widget.htmlEditorOptions.darkMode != false) { // //todo fix for iOS (https://github.com/pichillilorenzo/flutter_inappwebview/issues/695) // var darkCSS = // '<link href=\"${(widget.htmlEditorOptions.filePath != null ? "file:///android_asset/flutter_assets/packages/html_editor_enhanced/assets/" : "") + "summernote-lite-dark.css"}\" rel=\"stylesheet\">'; // await controller.evaluateJavascript( // source: "\$('head').append('$darkCSS');"); // }
from the file /html-editor-enhanced/lib/src/widgets/html_editor_widget_mobile.dart
for some reason it wasn't getting the context.
It's not a proper solution but kind of a temp solution IF YOU DON'T WANT TO USE THE LIGHT OR DARK THEME
Describe the bug
I am using an html editor to write description for a product, now the thing is, it works fine when the html editor is empty (default initialisation) when I use it in my Add Product Page but when I navigate to the Edit product page and try to assign a value to html editor it throws an exception.
Unhandled Exception: Looking up a deactivated widget's ancestor is unsafe.
At this point the state of the widget's element tree is no longer stable.
To safely refer to a widget's ancestor in its dispose() method, save a reference to the ancestor by calling dependOnInheritedWidgetOfExactType() in the widget's didChangeDependencies() method.
#0 Element._debugCheckStateIsActiveForAncestorLookup. (package:flutter/src/widgets/framework.dart:4153:9)
#1 Element._debugCheckStateIsActiveForAncestorLookup (package:flutter/src/widgets/framework.dart:4167:6)
#2 Element.dependOnInheritedWidgetOfExactType (package:flutter/src/widgets/framework.dart:4182:12)
#3 Theme.of (package:flutter/src/material/theme.dart:107:53)
#4 _HtmlEditorWidgetMobileState.build. (package:html_editor_enhanced/src/widgets/html_editor_widget_mobile.dart:456:34)
To Reproduce
this is my onInit function for the html editor
(descriptionField is the controller for this html editor)
(descriptionResult is the variable that contains raw string, the data to be shown in this html editor)
This is the complete code for the HTML Editor
Expected behavior
It does the job right but it slows down the App and it throws this exception
Screenshots
Device:
I am using a simulator and an iPhoneX for testing purposes
If you need the entire code or explanation I am all for it but I've been trying to resolve this issue for a while and I just can't figure this one out.
The text was updated successfully, but these errors were encountered: