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

Remove underline from image link? #312

Closed
lucien144 opened this issue Jun 2, 2020 · 6 comments
Closed

Remove underline from image link? #312

lucien144 opened this issue Jun 2, 2020 · 6 comments
Labels
bug Something isn't working

Comments

@lucien144
Copy link

Is there any way how to remove the underline from image wrapped in anchor but keep text links underlined?

Example:

Thanks.

@ryan-berger
Copy link
Collaborator

@lucien144 Nice catch. That definitely is not intended. I'll see if I can get working on that sometime this week.

@ryan-berger ryan-berger added the bug Something isn't working label Jun 11, 2020
@ryan-berger
Copy link
Collaborator

@lucien144 I've had to stop work on this for the day due to time limitations but I'll see if I can continue to work on this tomorrow. I'm getting somewhat close, but it is still definitely a WIP.

@lucien144
Copy link
Author

@ryan-berger Amazing, thanks! I found a workaround for now by adding custom class on the link that I style using the style property:

  String _tagAllImageLinks(String source) {
    Document document = parse(source);
    document.querySelectorAll('a > img').forEach((Element el) {
      el.parent.classes.add('image-link');
    });
    return document.body.innerHtml;
  }
Html(
     data: source,
     style: {
         ".image-link": Style(textDecoration: TextDecoration.none)
     }
);

@DFelten
Copy link
Contributor

DFelten commented Aug 10, 2020

Thanks for the workaround. A solution within flutter_html would be great.

@ryan-berger What's the status of the pull request? :)

@XingtianXin
Copy link

Html(
data: source,
style : {
'a': Style(
textDecoration: TextDecoration.none,
padding: EdgeInsets.all(0),
margin: EdgeInsets.all(0)),
'img': Style(padding: EdgeInsets.all(0), margin: EdgeInsets.all(0)),
};
);

This style works for me well. Thank you

@lucien144
Copy link
Author

@XingtianXin But that removes underline from all links, not image links only, no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants