Closed hortigado closed 10 months ago
Assuming your HTML has the P
tag. You can use customStylesBuilder
to specify the text alignment. Something like this:
HtmlWidget(
html,
customStylesBuilder: (e) {
if (e.localName == 'p') {
return {'text-align': 'justify'};
}
return null;
},
);
@daohoangson Thanks and if the html not have a tag and it is only text. I am reading a database where different values are returned, some just text and others in html text with tags.
If you have no control then it's probably easiest to just wrap it inside a div to apply some global style.
final withStyle = '<div style="text-align: justify">$html</div>';
Thank you, its working good.
Hi in the package Html() i can do the following
Html( style: { 'html': Style(textAlign: TextAlign.justify), }, )
Thanks