TextTheme: GoogleFonts.latoTextTheme(textTheme).copyWith(īodyMedium: GoogleFonts.oswald(textStyle: textTheme.bodyMedium), Or, if you want a TextTheme where a couple of styles should use a different font: final textTheme = Theme.of(context).textTheme TextTheme: GoogleFonts.latoTextTheme(baseTheme.textTheme), Var baseTheme = ThemeData(brightness: brightness) You can also use GoogleFonts.latoTextTheme() to make or modify an entire text theme to use the 'Lato' font. TextStyle: Theme.of(context).textTheme.displayLarge, To override the fontSize, fontWeight, or fontStyle: Text(
Style: GoogleFonts.lato(textStyle: Theme.of(context).textTheme.headline4), TextStyle: TextStyle(color: Colors.blue, letterSpacing. To use GoogleFonts with an existing TextStyle: Text( Or, if you want to load the font dynamically: Text( To use GoogleFonts with the default TextStyle: Text( Useful for offline-first apps.įor example, say you want to use the Lato font from Google Fonts in your Flutter app.Īdd the google_fonts package to your pubspec dependencies. Matching font files found in assets are prioritized over HTTP fetching.
Can also be used in production to reduce app size