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

标签 flutter custom-font

在 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/

相关文章:

css - 单击选择菜单(下拉菜单)时自定义字体不呈现

css - 如何在 CakePHP 中使用自定义字体?

flutter - 如何在flutter中删除文本字段光标气泡

flutter - ListTile 小部件 : No splash effect when a color is defined

flutter - flutter 网络中的路由具有意外行为

c# - WPF 自动换行 : Missing words when using custom font

android-studio - 如何在Flutter中使用容器内的扩展 block ?

dart - 在小部件或状态上保留最终字段?

android - 三星设备忽略 webview 自定义字体

ios - 无法在 Xcode 11 beta 中选择自定义字体?