4. Flutter - Custom Fonts

1. Create new "fonts" folder in flutter project.

2. Add font file to the folder

3. Edit "pubspec.yaml" 

4. Uncomment Font Section

5. Name a new family

6. Change the asset to reflect the font file.


fontFamily: 'FAMILY1', // to use this font in a text widget in the fontFamily property.


// CTRL+WINDOWS+/

to uncomment

// Tab 

to indent

// Shift+Tab

to unindent

  #   - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
fonts:
- family: FAMILY1
fonts:
- asset: fonts/IndieFlower-Regular.ttf

Comments

Popular posts from this blog

2. FreeCodeCamp - Dynamic Programming - Learn to Solve Algorithmic Problems & Coding Challenges

20. Data Analytics - Analyze Data to Answer Questions - Week 1

3. Algorithms - Selection Sort