Skip to main content

Change Font Size of the Whole App in Flutter

To change the font size of your app in Flutter, you can use the ThemeData class. This class provides methods for configuring the overall theme of an application.

To change the font size, you can use the textTheme property. This property expects a TextTheme instance, which defines various text styles.

MaterialApp(
  theme: ThemeData(
    textTheme: TextTheme(
      caption: TextStyle(
        fontSize: 14.0
      ),
      bodyText1: TextStyle(
          fontSize: 16.0
      ),
    ),
  ),
);
MaterialApp(
    title: 'App Title',
    debugShowCheckedModeBanner: false,
    theme: ThemeData(
        primarySwatch: MyTheme.mainColor, 
        textTheme: Theme.of(context).textTheme.apply(
              bodyColor: MyTheme.textColor,
              displayColor: MyTheme.textColor,
              fontFamily: GoogleFonts.aBeeZee().fontFamily,
              fontSizeFactor: 1.25,
            ),
        visualDensity: VisualDensity.adaptivePlatformDensity,
        backgroundColor: MyTheme.appBarColor),
    home: const LoginPage(),
)

By continuing to use the site, you agree to the use of cookies.