Complete the code to set the custom font family in the Text widget.
Text('Hello, Flutter!', style: TextStyle(fontFamily: '[1]'))
The fontFamily property in TextStyle sets the font to use. 'Roboto' is the custom font declared in pubspec.yaml.
Complete the pubspec.yaml snippet to include the custom font file.
fonts:
- family: Roboto
fonts:
- asset: [1]The font file path must match where you placed the font file in your project folder, usually under assets/fonts/.
Fix the error in the pubspec.yaml font declaration by completing the missing key.
flutter:
fonts:
- family: Roboto
[1]:
- asset: assets/fonts/Roboto-Regular.ttfThe key 'fonts' is required to list the font asset files under a family in pubspec.yaml.
Fill both blanks to apply the custom font and set font size in TextStyle.
Text('Custom Font', style: TextStyle(fontFamily: '[1]', fontSize: [2]))
Use the custom font family 'Roboto' and set fontSize to 24.0 for larger text.
Fill all three blanks to declare a custom font with regular and bold styles in pubspec.yaml.
fonts: - family: [1] fonts: - asset: [2] - asset: [3] weight: 700
This declares the 'Roboto' font family with regular and bold font files. The bold font has weight 700.