Home > Blockchain >  How to make it affect device font size to RichText and TextSpan
How to make it affect device font size to RichText and TextSpan

Time:10-21

I have a problem with RichText and TextSpan widgets. All Text widgets are affected by device font size (changed in settings) but RichText not. Any ideas about to solve it?

CodePudding user response:

I have solved it this way:

RichText(
    textScaleFactor: MediaQuery.of(context).textScaleFactor, <--- add this
    text: ...
)

CodePudding user response:

Actually RichText is one of the lower level widgets that you need to handle many things yourself.

You should try to use Text.rich() instead. It's pretty much the same thing as RichText but inherits styles from the parent widget tree.

  • Related