0
0
Fluttermobile~5 mins

Custom fonts in Flutter - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the first step to use a custom font in a Flutter app?
Add the font files (usually .ttf or .otf) to your project folder, typically under an assets or fonts directory.
Click to reveal answer
beginner
How do you tell Flutter about your custom fonts?
You declare the font in the pubspec.yaml file under the 'fonts' section, specifying the font family name and the path to the font files.
Click to reveal answer
beginner
How do you apply a custom font to a Text widget in Flutter?
Use the TextStyle class with the 'fontFamily' property set to the font family name you declared in pubspec.yaml.
Click to reveal answer
intermediate
Why is it important to declare multiple font weights in your custom font setup?
Declaring multiple weights (like regular, bold) allows Flutter to use the correct font style automatically when you set fontWeight in TextStyle.
Click to reveal answer
beginner
What happens if you forget to run 'flutter pub get' after adding fonts to pubspec.yaml?
Flutter won't recognize the new fonts and your app may show default fonts or errors when trying to use the custom font.
Click to reveal answer
Where should you place your custom font files in a Flutter project?
AIn the assets or fonts folder inside the project directory
BIn the lib folder only
CAnywhere on your computer
DIn the android folder only
Which file do you edit to register custom fonts in Flutter?
Amain.dart
Bbuild.gradle
CAndroidManifest.xml
Dpubspec.yaml
How do you specify the font family in a Text widget?
AfontFamily: 'YourFontName' in TextStyle
Bfont: 'YourFontName' in Text widget
Cstyle: 'YourFontName' in Text widget
DfontName: 'YourFontName' in TextStyle
What is the purpose of declaring multiple font weights in pubspec.yaml?
ATo make fonts load faster
BTo reduce app size
CTo allow Flutter to use different font styles like bold or light
DTo change font colors
What command should you run after editing pubspec.yaml to add fonts?
Aflutter run
Bflutter pub get
Cflutter clean
Dflutter build
Explain the steps to add and use a custom font in a Flutter app.
Think about where the font files go, how Flutter knows about them, and how to apply them in code.
You got /4 concepts.
    Why is it helpful to declare different font weights for a custom font in Flutter?
    Consider how text styles like bold or light are controlled.
    You got /3 concepts.