dart - Flutter Web 不显示 Material Design 图标

标签 dart flutter flutter-web

我启动了 Flutter web,我想将 Material 图标添加到我的 Flutter web 应用程序中,但改为显示框。

enter image description here

感谢任何帮助。谢谢

最佳答案

来自 flutter_web repository :

注意:有意省略了对 MaterialIcons 的引用,因为相应的字体未包含在此源中。

如果你将MaterialIcons-Extended.ttf添加到这个目录,你可以更新FontManifest.json如下:

[
  {
    "family": "MaterialIcons",
    "fonts": [
      {
        "asset": "MaterialIcons-Extended.ttf"
      }
    ]
  },
  {
    "family": "GoogleSans",
    "fonts": [
      {
        "asset": "GoogleSans-Regular.ttf"
      }
    ]
  },
  {
    "family": "GalleryIcons",
    "fonts": [
      {
        "asset": "GalleryIcons.ttf"
      }
    ]
  }
]

解决方案/解决方法

下载MaterialIcons-Regular.ttf here ,将其放入您的 assets 文件夹并相应地更新您的 FontManifest.json

关于dart - Flutter Web 不显示 Material Design 图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56067767/

相关文章:

flutter 网络 : Cannot scroll with mouse down (drag) (Flutter 2. 5+)

flutter - 如何在 Flutter 中完全隐藏密码输入?

flutter - 使用类参数传递 BlocProvider

flutter - 如何比较在Dart中构造不同的两个日期?

Dart/网络 Storm "Cancel instances of dart.async.StreamSubscription"

dart - Flutter如何在appbar的标题下对齐字幕?

list - Flutter(Dart) 无法从不可修改的列表中删除

dart - dart/flutter 中的这个一元后缀是什么?

firebase - 如何通过 flutter 在网络上再次请求通知权限

syntax - Dart中点前的问号