在 pubspec.yaml 中添加自定义字体样式给出
Error detected in pubspec.yaml:
Invalid value Bold ((String)) for font -> style.
Please correct the pubspec.yaml file at /Users/directory/pubspec.yaml
这里是 pubspec.yaml 中的代码
fonts:
- family: Gilroy
fonts:
- asset: fonts/gilroy_bold.ttf
style: Bold
- asset: fonts/gilroy_bolditalic.ttf
weight: 900
- asset: fonts/gilroy_medium.ttf
weight: 700
最佳答案
你想要这个。
fonts:
- family: Gilroy
fonts:
- asset: fonts/gilroy_bold.ttf
weight: 700
- asset: fonts/gilroy_bolditalic.ttf
weight: 700
style: italic
- asset: fonts/gilroy_medium.ttf
weight: 500
关于flutter - Flutter 中字体 -> 样式的无效值样式 ((String)),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64711822/