Reputation: 1932
How do I set the text style to headline1
or body1
like it is described in the "Material Text Scale: Modernizing Flutter Text Theming" section of the Flutter 1.17 Announcement article
final TextStyle TEXT_STYLE = GoogleFonts.lato(textStyle: *something in here?*);
Upvotes: 0
Views: 308
Reputation: 302
The typographic style headline1
was deprecated after v3.1.0-0.0.pre
in favour of displayLarge
, while body1
in the Material Design specification was named bodyText1
in Flutter 1.17, but has also been deprecated in favour of displayLarge
.
In your usecase with the Google Fonts library, to obtain a TextStyle
you should use:
final TextStyle TEXT_STYLE = GoogleFonts.lato(textStyle: Theme.of(context).textTheme.displayLarge),
replacing displayLarge
with your chosen theme size. The full list of sizes can be found within the documentation, but if you have overriden the TextTheme, you may not see the actual font size changes.
Upvotes: 0
Reputation: 121
You can do this by creating a TextTheme object and using the available styles.
In your example:
final TextStyle TEXT_STYLE = GoogleFonts.lato(textStyle: TextTheme().bodyText1);
Upvotes: 1