Closed gabrielaraujoz closed 1 year ago
This is by design, to follow web standards. You can set a body margin to zero.
Html(
...
style: {
"body": Style(margin: EdgeInsets.zero),
},
)
This is by design, to follow web standards. You can set a body margin to zero.
Html( ... style: { "body": Style(margin: EdgeInsets.zero), }, )
Thanks! I tried it out and it worked, you're a genius!
It should be like this?
Html(
...
style: {
"body": Style(margin: Margins.zero),
},
)
But when I tried the solution, it doesn't work.
Html(
data: state.loaded?.content ?? '',
style: {
'html': Style(
padding: EdgeInsets.zero,
margin: Margins.zero,
color: ColorName.gray3,
fontWeight: FontWeight.w600,
lineHeight: LineHeight.em(1.3),
fontFamily: FontFamily.pingFang,
fontSize: FontSize.medium),
},
);
Ah, I added body": Style(margin: Margins.zero
to style, and now it worked. Sorry for misunderstood.
Html(
data: state.loaded?.content ?? '',
style: {
'body': Style(margin: Margins.zero, padding: EdgeInsets.zero),
'html': Style(
padding: EdgeInsets.zero,
margin: Margins.zero,
color: ColorName.gray3,
fontWeight: FontWeight.w600,
lineHeight: LineHeight.em(1.3),
fontFamily: FontFamily.pingFang,
fontSize: FontSize.medium),
},
);
Describe the bug:
When using Html widget with any text, it will add an extra 8px horizontal padding, making it misaligned with other Text widgets when used in a Column/Row. Example widget tree configuration:
HTML to reproduce the issue:
Html
widget configuration:Expected behavior:
Screenshot taken using a Text Widget to illustrate the expected alignment
Screenshots:
Device details and Flutter/Dart/
flutter_html
versions:iOS Simulator, iPhone SE 1st generation Flutter 3.3.8 flutter_html: 3.0.0-alpha.6
Additional info:
This can be fixed by adding a left padding to the other elements in the column with 8px, but I believe the Html should not have an intrinsic padding that cannot be switched off.
A picture of a cute animal (not mandatory but encouraged)