How can I change every text of my app to use a specific font? I can change them individually by using the TextStyle()
but how can I make my app default to a specific font? Can you show me how?
The default font of MaterialApp is roboto , a Google font.
Text( 'Home', style: TextStyle( fontWeight: FontWeight. w300, // light fontStyle: FontStyle. italic, // italic ), );
You can change the default font family of your Flutter app by following the below steps:
1. Add your font files into your project folder. Say Project Folder > assets > fonts > hind
.
2. Declare the font family with font files with style in your project's pubspec.yaml
file as (An example):
MaterialApp
widget of your main class file, define the default font family as:If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With