Skip to content
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

<a> wrap <span> style no effect #832

Closed
callmejm opened this issue Sep 7, 2021 · 7 comments
Closed

<a> wrap <span> style no effect #832

callmejm opened this issue Sep 7, 2021 · 7 comments
Labels

Comments

@callmejm
Copy link

callmejm commented Sep 7, 2021

final html = '<a href="https://www.google.com/"><span>Google</span></a>';

 "a": Style(
    fontFamily: Theme.of(context).textTheme.bodyText1!.fontFamily,
    height: 1.4,
    color: Colors.blue
  ),
  "span":Style.fromTextStyle(Theme.of(context).textTheme.bodyText1!.copyWith(
      height: 1.4
    )
  ).merge(html ?? Style()),

image

I have <a> with child <span> , <a> no change to blue, and I cant set "span" to color: Colors.blue , it will overwrite other span color

@tneotia
Copy link
Collaborator

tneotia commented Sep 7, 2021

We don't inherit color property. However in style you can use any CSS selector so you should be able to use a > span rather than just span. This will select any span with a as the parent rather than every single span.

@callmejm
Copy link
Author

We don't inherit color property. However in style you can use any CSS selector so you should be able to use a > span rather than just span. This will select any span with a as the parent rather than every single span.

Hi, the html are generated by tinymce, so I can't control the style

@tneotia
Copy link
Collaborator

tneotia commented Sep 12, 2021

Hi, the html are generated by tinymce, so I can't control the style

I mean to do this:

"a > span": Style.fromTextStyle(Theme.of(context).textTheme.bodyText1!.copyWith(
      height: 1.4,
      color: Colors.blue,
    )
  )

@callmejm
Copy link
Author

@tneotia not working, because I already have a standard style for span

"span":Style.fromTextStyle(Theme.of(context).textTheme.bodyText1!.copyWith(
  height: 1.4
)
).merge(html ?? Style()),

@erickok
Copy link
Collaborator

erickok commented Nov 29, 2021

🤔 You might to to change the order of the style definitions then. We do apply all styles that are applicable.

@tneotia
Copy link
Collaborator

tneotia commented Nov 30, 2021

It seems we have fixed this issue somehow because I just tried this HTML, and it correctly shows with blue underline.

@erickok
Copy link
Collaborator

erickok commented Nov 30, 2021

Let us know if this issue persists. Thanks!

@erickok erickok closed this as completed Nov 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants