Jovanovski
Jovanovski

Reputation: 232

Flutter: Text fontSize does not scale

This is the same app, on 2 different devices. The layout seems to scale just fine, but the font size does not. I have no clue what could be the cause or where to start looking. The first is on a Pixel 2 and looks normal, the second is on a Galaxy A7 2018 and the text is off scale.

enter image description here

enter image description here

Upvotes: 0

Views: 179

Answers (1)

Jovanovski
Jovanovski

Reputation: 232

George in the comments was right, it was an option in android to scale fonts that caused this effect. I had to use the code (from here) below to set the app-wide textScaleFactor back to 1.0.

MaterialApp(
      builder: (context, child) {
        return MediaQuery(
          child: child,
          data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
        );
      },
)

Upvotes: 1

Related Questions