Using Google Fonts

Limited number of fonts are available in the Flutter. But we can use as many type of fonts we want from google. 
The font of the appbar is created from google fonts


at first download the font file of your choice from Google Fonts .
you will get a zip file . In that zip file there will be one (TrueTypefontfile) and another one will be a text file that's actually the license .
Now make a directory in your flutter project (name that file as "fonts" that will be helpful)
now drag that TrueType fontfile into the fonts directory .Our font file is now ready to use.

Now we have to open the pubspec.yaml . .Indentation is really important for the pubspec.yaml file. so just copy paste it under flutter:
fonts:
- family: AbrilFatface
fonts:
- asset: fonts/AbrilFatface-Regular.ttf
Now make sure the indentation gap between flutter: and fonts: is 2. This is really important.
Change the family and asset according to the file name.
(file name is supposed to be like "something-Regular", put that something part in the family
and the whole name in asset. if you had created directory with another name then use that 
instead of fonts in asset.) 
Then run pub get.
Make sure there is no error , if you get error follow the steps again.
now your new font is ready to use. use that in any Text Widget.
child:Text('PROBASEE BENGALEE ASSOCIATION',
style:TextStyle(fontFamily:'AbrilFatface')
)

Comments

Popular posts from this blog

Circular Menu Flutter