Flutter global font size multiplier
1 min readSep 22, 2020
Android and iOS both have a system setting to make texts bigger or smaller in general. Flutter takes it into account. It uses it by default.
Get the value “textScaleFactor” using MediaQuery
MediaQuery.of(context).textScaleFactor
https://api.flutter.dev/flutter/widgets/MediaQuery-class.html
In case if you want to turn this mechanism off, or change scaling value for a part of your app, wrap it in your own MediaQuery object.
Widget build(BuildContext context) {
double myOwnScaleFactor = 1.0;
return MediaQuery(
child: Container(), // your app, or part of it
data: MediaQuery.of(context).copyWith(textScaleFactor: myOwnScaleFactor),
);
}