This articles helps you to integrate google fonts and custom fonts in your flutter applications. Google Fonts provide flutter package which helps us to integrate any of the google fonts in our applications.
For custom font, you can store font file in assets folder and you can use.
There are two ways to integrate fonts in flutter applications: Google Fonts and Custom Fonts. For Google Fonts you do not need to store .ttf or .otf file in assets folder. Google fonts are fetched from http once then they are stored in cache memory of application.
Add below dependency in your pubspec file
Import Google Flutter Fonts Package
Integrate Google Flutter Fonts
You can use google fonts in flutter applications using different ways.
Only change font style
Change Font Style With Size
Change Font Style With Custom Text Style
Change Font Style With Different Parameters
Change Font Style For All Texts in Application
Integrate Custom Fonts
Put .ttf or .otf fonts files in fonts folder in project
First you need to download font file whatever font you want to integrate. Then you need to extract this zip file. Then create fonts folder under main project and put these .ttf or .otf files in this folder.
Add font file path in pubspec file
– asset: fonts/nunito_black.ttf
Integrate fonts in text widget
We can integrate fonts in text widget using fontFamily parameter. You need to give exact font file name to font family parameter in text widget. Now you can run project and see your custom fonts in your application.