How to show html containing mathjax(specialy chemistry) without using webview?

28 views Asked by At

I can use flutter_html package to show mathjax in flatter. I posted another question and got a solution that solved for only math equation. Now I want to render chemistry formula also because my html contains chemistry equation alongside the math equation. <p>স্ফুটনাঙ্কের উচ্চক্রম অনুসারে \(\ce{HF, H2O, NH3}\) এবং \(\ce{CH4}\) যৌগসমূহকে তালিকাভূক্ত করলে নিচের কোনটি সঠিক হবে?</p>

Here is the solution from my previous question.

How to show html containing mathjax without using webview

Html(
  data:
      r'<p>যদি <tex>\mathrm{a+b=\sqrt{5}}</tex> এবং <tex>\mathrm{a-b=\sqrt{3}}</tex> হয়, তবে <tex>\mathrm{a^2+b^2=}</tex> কত?</p>',
  shrinkWrap: true,
  extensions: [
    TagExtension(
      tagsToExtend: {"tex"},
      builder: (extensionContext) {
        return Math.tex(
          extensionContext.innerHtml,
          textStyle: extensionContext.styledElement?.style
              .generateTextStyle(),
          onErrorFallback: (FlutterMathException e) {
            return Text(e.message);
          },
        );
      },
    ),
  ],
)

In addition I want to avoid webview because it takes so much time to render mathjax.

0

There are 0 answers