8000 [BUG] vertical-align not working in Html/SelectableHtml · Issue #1107 · Sub6Resources/flutter_html · GitHub
[go: up one dir, main page]

Skip to content
[BUG] vertical-align not working in Html/SelectableHtml #1107
Closed
@kaiquegazola

Description

@kaiquegazola

Describe the bug:

vertical-align property doesn't work as expected.

HTML to reproduce the issue:

<span>3</span><span style="vertical-align: super">x</span><span>-27 = 0<sup>x</sup></span>

Html widget configuration:

Using clean Html or SelectableHtml.

Additional info:

I couldn't find the property vertical-align in the parser file:

Style declarationsToStyle(Map<String, List<css.Expression>> declarations) {

I try to put it, like this, seems works fine in Html default constructor

case 'vertical-align':
  style.verticalAlign =
      ExpressionMapping.expressionToVerticalAlign(value.first);
  break;

// ... //

static VerticalAlign expressionToVerticalAlign(css.Expression value) {
  if (value is css.LiteralTerm) {
    switch (value.text) {
      case "sub":
        return VerticalAlign.SUB;
      case "super":
        return VerticalAlign.SUPER;
    }
  }
  return VerticalAlign.BASELINE;
}

but that doesn't work with the SelectableHtml constructor, throwing a exception in this cast:

return customRenders[entry]!.inlineSpan!.call(newContext, buildChildren) as TextSpan;

i think its are related to flutter/flutter#38474, since it is merged, it's a leftover? removing this cast, works fine in my test case.

A picture of a cute animal (not mandatory but encouraged)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcssEnhancements/issues with css propertiesselectable-html

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0