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

Text disappears upon using the "textStyle" property of HtmlWidget #45

Closed
DontStopThinking opened this issue May 29, 2019 · 4 comments
Closed
Assignees
Labels
enhancement New feature or request

Comments

@DontStopThinking
Copy link

I would really like to be able to change the font size but it seems that the rendered text disappears entirely as soon as I assign a new TextStyle to the "textStyle" property.
Here's what my code looks like:

HtmlWidget(this.content, webView: true, webViewJs: true, textStyle: new TextStyle(fontSize: 15.0));

It works fine without the textStyle:

HtmlWidget(this.content, webView: true, webViewJs: true);

Any thoughts on this?

@daohoangson
Copy link
Owner

You need to get the default text style and adjust it instead of creating a new style from scratch (it won't have a color so it's invisible). I will try to improve this in the next version. In the mean time, please try this:

final defaultStyle = DefaultTextStyle.of(context).style;
final textStyle = defaultStyle.copyWith(fontSize: 15);

return HtmlWidget(...);

@daohoangson daohoangson self-assigned this May 29, 2019
@daohoangson daohoangson added the enhancement New feature or request label May 29, 2019
daohoangson added a commit that referenced this issue May 29, 2019
@DontStopThinking
Copy link
Author

That worked. Many thanks for all your hard work :)

@daohoangson
Copy link
Owner

v0.2.1+1 has been released with smarter TextStyle support. It's now possible to give HtmlWidget an incomplete text stype.

@daohoangson
Copy link
Owner

I'm closing this issue because a new version has been released to address it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants