I have a MaterialApp in Flutter and want to scale up text throughout the entire app, base in user preferences.
CodePudding user response:
You could use the property textScaleFactor. You have to include your variable in every Text Widget. To save the variable you can use SharedPreferences.
Example:
Text("dummy data",textScaleFactor: yourVariable,)
CodePudding user response:
To programmatically increase the font size for the entire app in Flutter, you can use a MediaQuery widget at the root of your app. This widget allows you to access the device's media and display information, such as the screen size and the current text scale factor.
MediaQuery(
data: MediaQuery.of(context).copyWith(
// Increase the text scale factor to 1.5
textScaleFactor: 1.5,
),
child: YourApp(),
),