Flutter中字体->样式的值样式((String))无效

gy2006_sw

关注

阅读 160

2022-06-07


在 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

所以​style: bold​​不起作用,是因为​​Flutter​​ > ​​dart:ui​​ > ​​FontStyle enum​​中只有两个常量,分别是:

  • italic → const FontStyle
  • normal → const FontStyle
  • values → const List<FontStyle>

检查: ​​https://api.flutter.dev/flutter/dart-ui/FontStyle.html​​

精彩评论(0)

0 0 举报