Flutter - ignore system Display Size setting

Viewed 366

I'm having an issue regarding devicePixelRatio and Display Size settings on Android. App works great if Display Size is set to default, problems begin with bigger values. I know that for system Font Size setting I can just set textScaleFactor to 1.0 like so:

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

I'm not sure if I can do the same for devicePixelRatio (which is affected by Display Size setting) or rather if there is a way I can obtain the default value of devicePixelRatio.

1 Answers

Try this!

return MaterialApp(
      navigatorKey: globals.navKey,
      builder: (context, child) {
        return MediaQuery(
          child: child],
          data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
        );
       }
     );
Related