RichText has different text size on some devices
I'm using RichText
in my app but when I use it on some Android phones the text is bigger than when I use a Text
with the same style.
How can I ensure that also RichText
uses the same text size as Text
?
Solution 1:
I found the answer.
This error happens on devices with a different font size or display size. So the user has changed the text scaling for the whole OS (in my case to smaller). The framework - I guess Android - doesn't consider that for RichText
.
You have to manually apply the scale factor:
RichText(
textScaleFactor: MediaQuery.of(context).textScaleFactor,
text: TextSpan(''),
)