An idea of a better use of Google fonts. Main typography of the app.
When I want to apply the Google Fonts package in all instances I have this
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
textTheme: GoogleFonts.latoTextTheme(
Theme.of(context).textTheme,
),
),
);
}
}
And I'm not able to customize my own theme like changing the size or color of my theme like this...
ThemeData mainTheme = ThemeData(
brightness: Brightness.light,
primaryColor: primaryColor,
accentColor: accentColor,
scaffoldBackgroundColor: Colors.indigo[50],
);
because ThemeData is already in use.
It Will be Awesome to have this...
ThemeData mainTheme = ThemeData(
brightness: Brightness.light,
primaryColor: primaryColor,
accentColor: accentColor,
scaffoldBackgroundColor: Colors.indigo[50],
typography: GoogleFonts.roboto
);
Or something similar because I have to change every textTheme o my Typography to use it like this...
ThemeData mainTheme = ThemeData(
brightness: Brightness.light,
primaryColor: primaryColor,
accentColor: accentColor,
scaffoldBackgroundColor: Colors.indigo[50],
textTheme: TextTheme(
body1: body1,
),
);
final TextStyle body1 = GoogleFonts.nunito(
fontSize: 16,
fontWeight: FontWeight.normal,
fontStyle: FontStyle.normal,
textStyle: TextStyle(
letterSpacing: 0.5,
),
);
and this happens to every style I want to use, don’t get me wrong I also like it the way it is because I can use as many Fonts I like, but I will prefer the main font set.
This is a good candidate for community contribution! Consider putting in a pull request as we will not get to this soon but we'd be happy to sheperd a PR.
When I want to apply the Google Fonts package in all instances I have this
class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( theme: ThemeData( textTheme: GoogleFonts.latoTextTheme( Theme.of(context).textTheme, ), ), ); } }And I'm not able to customize my own theme like changing the size or color of my theme like this...
ThemeData mainTheme = ThemeData( brightness: Brightness.light, primaryColor: primaryColor, accentColor: accentColor, scaffoldBackgroundColor: Colors.indigo[50], );because ThemeData is already in use.
It Will be Awesome to have this...
ThemeData mainTheme = ThemeData( brightness: Brightness.light, primaryColor: primaryColor, accentColor: accentColor, scaffoldBackgroundColor: Colors.indigo[50], typography: GoogleFonts.roboto );Or something similar because I have to change every textTheme o my Typography to use it like this...
ThemeData mainTheme = ThemeData( brightness: Brightness.light, primaryColor: primaryColor, accentColor: accentColor, scaffoldBackgroundColor: Colors.indigo[50], textTheme: TextTheme( body1: body1, ), ); final TextStyle body1 = GoogleFonts.nunito( fontSize: 16, fontWeight: FontWeight.normal, fontStyle: FontStyle.normal, textStyle: TextStyle( letterSpacing: 0.5, ), );and this happens to every style I want to use, don’t get me wrong I also like it the way it is because I can use as many Fonts I like, but I will prefer the main font set.
GoogleFont is not working
Marking as closed due to author's follow-up PR https://github.com/material-foundation/google-fonts-flutter/pull/139.