Skip to content

Instantly share code, notes, and snippets.

@ffkev
Last active April 11, 2024 06:00
Show Gist options
  • Save ffkev/8d784f8a7f8149b6af93f3d5fc271d8e to your computer and use it in GitHub Desktop.
Save ffkev/8d784f8a7f8149b6af93f3d5fc271d8e to your computer and use it in GitHub Desktop.
There is a MediaQuery property in Flutter which you can use to restrict scaling of your fonts on different devices based on the device accessibility settings.
MediaQuery(
// This will set scaling for the app to always remain 1:1 globally
data: MediaQuery.of(context).copyWith(textScaler: TextScaler.linear(1.0)),
// Wrap your Material App with MediaQuery to implement this
child: MaterialApp.router(
title: 'ScaleFactorText',
...
),
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment