Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Styling Html Widget in Flutter Dart

Tags:

flutter

dart

I am using the flutter_html package

I have this in my flutter project, i have been trying to style the line height property of the resulting text rendered in my view and its not working and i dont seem to find a solution anywhere. Any help will be appreciated Html(

              data: detail.length >= 300 ? detail.substring(0, 300) + " ...": detail.substring(0),
               style: {
                "html":Style(
                 /*  wordSpacing: 3, */
                  textAlign: TextAlign.justify,
                 whiteSpace: WhiteSpace.NORMAL
                ),
              },
              )
like image 339
Wales77 Avatar asked Feb 04 '26 06:02

Wales77


1 Answers

Currently the Html() widget from flutter_html: ^1.x.x is not supporting line-height property of css. So you need to use HtmlWidget() from flutter_widget_from_html: ^0.5.x

HtmlWidget(
         htmlData,
         textStyle: TextStyle(height: 1.8)
         )
like image 106
Saravanan Avatar answered Feb 07 '26 00:02

Saravanan



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!