Flutter - 找不到某些图标

发布于 2025-01-10 08:52:01 字数 464 浏览 1 评论 0原文

我正在尝试使用 Icon(Icons.factory) 但它没有显示:在 VSCode 中,甚至在我的应用程序中。

你知道为什么吗? (我看到我需要添加 font_awesome_fluttermaterial_design_icons_flutter 但它是强制性的吗?)

我正在使用 cupertino_icons: ^1.0.4 & uses-material-design: true 在我的 pubspec.yaml

在此处输入图像描述

I'm trying to use Icon(Icons.factory) but it not displayed: in VSCode and even in my app.

Do you know why? (I saw I need to add font_awesome_flutter or material_design_icons_flutter but is it mandatory?)

I'm using cupertino_icons: ^1.0.4 & uses-material-design: true in my pubspec.yaml

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

只有一腔孤勇 2025-01-17 08:52:01

我在 cupertino 文档中没有看到任何名为 factory 的图标,但如果您想添加 ide 选项中尚未存在的任何图标,只需访问 flutters cupetino 文档并单击您想要的图标即可想。例如,选项中尚不可用的 paperlane 图标

static const IconData paperplane = IconData(0xf733, fontFamily: iconFont, fontPackage: iconFontPackage);

将上面的代码更改为

static const IconData paperplane = IconData(0xf733, fontFamily: CupertinoIcons.iconFont, fontPackage: CupertinoIcons.iconFontPackage);

那么你可以在代码中使用字体作为

Icon(paperplane)

请记住更新你的 cupertino 包并导入文件以使某些图标可以工作

I haven't seen any icon with name factory in the cupertino documentation but if you want to add any icon which is not yet present in your ide's options, simply visit flutters cupetino docs and click on the icon you want. For example the paperlane icon which is not yet available in the options

static const IconData paperplane = IconData(0xf733, fontFamily: iconFont, fontPackage: iconFontPackage);

change above code to

static const IconData paperplane = IconData(0xf733, fontFamily: CupertinoIcons.iconFont, fontPackage: CupertinoIcons.iconFontPackage);

then you can use the font in your code as

Icon(paperplane)

Remember to update your cupertino package and import the file for some icons to work

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文