Search code examples
htmlcssflutterdartflutter-html

How to use external CSS class using flutter_html?


I'm using flutter_html to load a widget from HTML. I got the builder from an API that returns a HTML string with an external CSS class, roughly like this:

<p class="text-right">Supposed to be following text-right styles</p>

Suppose I have the styling for the "text-right" class, how can we load the style using flutter_html? In this case, I'm not using flutter WebView and I don't want to since the HTML only a small widget inside an existing scrolling page.


Solution

  • I'm using 3.0.0 and was able to do the following:

    "p.text-right" : Style(
      textAlign: TextAlign.right
    ),