Skip to content

[BUG] vertical-align not working in Html/SelectableHtml #1107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kaiquegazola opened this issue Jul 14, 2022 · 3 comments · Fixed by #1266
Closed

[BUG] vertical-align not working in Html/SelectableHtml #1107

kaiquegazola opened this issue Jul 14, 2022 · 3 comments · Fixed by #1266
Labels
bug Something isn't working css Enhancements/issues with css properties selectable-html
Milestone

Comments

@kaiquegazola
Copy link
Contributor

kaiquegazola commented Jul 14, 2022

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)

@kaiquegazola kaiquegazola added the bug Something isn't working label Jul 14, 2022
@dragnev-dev
Copy link

Related #717.

@Sub6Resources Sub6Resources added css Enhancements/issues with css properties selectable-html labels Aug 20, 2022
@Sub6Resources Sub6Resources added this to the 3.0.0 milestone Aug 20, 2022
@IvanVnucec
Copy link

What is the status on this?

Can someone provide instructions on what could be done to implement this?

@Sub6Resources
Copy link
Owner

Sub6Resources commented Nov 2, 2022

Still in progress. The code provided in the initial comment should be sufficient for a pull request, if someone would like to open one. SelectableHtml is being removed in 3.0.0 anyways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working css Enhancements/issues with css properties selectable-html
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants