Closed NTJ3 closed 1 year ago
You can't really add a Wrap
in a custom render, because Flutter doesn't support such layout widgets in a RichtText
(which is essentially what Html
is). Instead you should try to break up the latex itself in parts before offering the html to Html
. Alternatively you can use a custom render which splits the latex (which I think you already do in texBreak
?) and return it as InlineSpan.
I have removed Wrap @erickok but it's didn't work out Can we have quick meet if you available?
Updating your configuration with the latest 3.0.0-beta.1 gives me the following, which worked when I tested it on flutter web (with both renderers) and MacOS.
return Html(
shrinkWrap: true,
data:r"The number of distinct solutions of the equation<tex>\frac{4}{5}</tex>cos<sup>2</sup>2x+cos<sup>4</sup>x+sin<sup>4</sup>x+cos<sup>6</sup>x+sin<sup>6</sup>x=2 in the interval <tex>\left[0,2\pi\right]</tex> is<u>________</u>.",
extensions: [
TagExtension(
tagsToExtend: {'tex'},
builder: (extContext) {
final longEq = Math.tex(extContext.element!.text);
final breakResult = longEq.texBreak();
return CssBoxWidget.withInlineSpanChildren(
style: extContext.styledElement!.style,
children: breakResult.parts.map((child) {
return WidgetSpan(child: child);
}).toList(),
);
},
)
],
);
Describe the bug:
We are using flutter_html package to render html and latex together. But with below html string web is crashing HTML string:
HTML to reproduce the issue:
Html
widget configuration:Expected behavior:
It should render as pic below
Screenshots:
Device details and Flutter/Dart/
flutter_html
versions:Flutter Version: 3.3.4 flutter_html: ^2.2.1 flutter_math_fork: 0.5.0 Stacktrace/Logcat
Additional info:
A picture of a cute animal (not mandatory but encouraged)