flutter-packages icon indicating copy to clipboard operation
flutter-packages copied to clipboard

An idea of a better use of Google fonts. Main typography of the app.

Open Classy-Bear opened this issue 6 years ago • 2 comments

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.

Classy-Bear avatar Dec 17 '19 20:12 Classy-Bear

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.

willlarche avatar Feb 13 '20 16:02 willlarche

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

sudoosama avatar Aug 25 '20 16:08 sudoosama

Marking as closed due to author's follow-up PR https://github.com/material-foundation/google-fonts-flutter/pull/139.

esouthren avatar Nov 07 '22 17:11 esouthren