Skip to content

[BUG] Top margin gets set to '[text]' margin  #1155

Closed
@arjanmels

Description

@arjanmels

Describe the bug:
The '[text]' elements get a bottom of margin of 32 in my case.
In the _collapseMargins routine this gets collapsed into the next elements margin.

My solution/workaround add a Style to the style map with key '[text]' setting sthe margins to 0.

HTML to reproduce the issue:

<p>test1</p>
<p>test2</p>

Html widget configuration:

Html.fromDom(
            document: _document,
            style: buildContext.styles.htmlStyle,
            customRenders: {
              tableMatcher(): tableRender(),
              _summaryMatcher(): CustomRender.inlineSpan(inlineSpan: (context, buildChildren) {
                var style = context.tree.children.first.style;
                style.color = null;
                var textStyle = style.generateTextStyle();
                return WidgetSpan(child: Text(context.tree.element?.text ?? '', style: textStyle));
              }),
            },
          ),

Expected behavior:
No margin on [text] element by default

Screenshots:
N/A

Device details and Flutter/Dart/flutter_html versions:
Version: 3.0.0-alpha6

Stacktrace/Logcat
N/A
Additional info:
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions