Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove Flutter HTML widget's default padding

There is a default padding in flutter_html already when trying to parse text.

Below is the difference between using HTML(data: ...) and Text(...) widgets.

Top: HTML Widget, Bottom: Text Widget
Screenshot Reference

How can I remove the horizontal padding?

like image 286
Mihail Iliev Avatar asked Dec 10 '25 12:12

Mihail Iliev


2 Answers

The HTML or body is having a default padding and/or margin.

Try adding

"body": Style(margin: Margins.all(0), ...)

in the style parameter.

like image 92
Sahil Sonawane Avatar answered Dec 12 '25 04:12

Sahil Sonawane


Html has updated, so I update accepted answer:

          "body": Style(
             padding: HtmlPaddings.zero,
             margin: Margins.zero,
           ),
like image 35
manhtuan21 Avatar answered Dec 12 '25 03:12

manhtuan21



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!