How to change Font style in Html widget in Flutter?

You could use customTextStyle to change the font size.

customTextStyle: (dom.Node node, TextStyle baseStyle) {
              return baseStyle.merge(TextStyle(height: 2, fontSize: 28));
              }

Complete example,

 Html( data: user['news_description'],
       customTextStyle: (dom.Node node, TextStyle baseStyle) {
                  return baseStyle.merge(TextStyle(height: 2, fontSize: 28));
                  })

Using flutter_html for richtext html.

Try this code to change the Html font style:

Html(
    data: 'my text',
    style: {
    "body": Style(
    fontSize: FontSize(18.0),
    fontWeight: FontWeight.bold,
    ),
    },
)

Tags:

Dart

Flutter