dart - How to manage global textScaleFactor in Flutter app properly? - Stack Overflow

PHOTO EMBED

Thu Jun 23 2022 21:48:21 GMT+0000 (UTC)

Saved by @Habeeb #dart

@override
Widget build(BuildContext context) {
  MediaQueryData windowData =
      MediaQueryData.fromWindow(WidgetsBinding.instance!.window);
  windowData = windowData.copyWith(
    textScaleFactor:
        windowData.textScaleFactor > 1.4 ? 1.4 : windowData.textScaleFactor,
  );
  return MediaQuery(
    data: windowData,
    child: MaterialApp(
      useInheritedMediaQuery: true,

      //...
    ),
  );
}

content_copyCOPY

https://stackoverflow.com/questions/56034572/how-to-manage-global-textscalefactor-in-flutter-app-properly