简体   繁体   English

如何使用 Flutter Cupertino 图标?

[英]How to use Flutter Cupertino Icons?

I know that to use them you have to import 'package:flutter/cupertino.dart';我知道要使用它们你必须import 'package:flutter/cupertino.dart'; and use it like this Icon(CupertinoIcons.info);并像这样使用它Icon(CupertinoIcons.info); but it's hard to pick needed icon.但很难选择所需的图标。

Dear Flutter team, please make complete Cupertino icons reference somewhere.亲爱的 Flutter 团队,请在某处提供完整的库比蒂诺图标参考。 One place has names without icons and other has icons without names.一个地方有没有图标的名字,另一个地方有没有名字的图标。

UPDATE:更新:

As Mariano noted and as shown in this answer name mapping is not yet complete and we can use icons as follows:正如马里亚诺所指出的,如本答案所示,名称映射尚未完成,我们可以使用如下图标:

 const IconData baseball = const IconData(0xf3dd,
          fontFamily: CupertinoIcons.iconFont,
          fontPackage: CupertinoIcons.iconFontPackage);
 Icon(baseball);

Where 0xf3dd is a code of an icon (f3dd) which you can find here .其中 0xf3dd 是图标 (f3dd) 的代码,您可以在此处找到。

You answered your own question, the usage of the CupertinoIcons class is as you described.您回答了自己的问题,CupertinoIcons 类的用法如您所描述的。


You are right though, there is no easy way to find the name of the icon from the map image provided in the github repository, since they don't directly map the system icons described by Apple in their human interface guidelines: Human interface guidelines您是对的,没有简单的方法可以从 github 存储库中提供的地图图像中找到图标的名称,因为它们没有直接映射 Apple 在其人机界面指南中描述的系统图标: 人机界面指南

You can go to the main flutter repository and open an issue about this subject Flutter Github repo .您可以转到主 flutter 存储库并打开有关此主题的问题Flutter Github repo
You could even contribute the map yourself and help other developers that might be having the same issue.您甚至可以自己贡献地图并帮助其他可能遇到相同问题的开发人员。

This is the best reference that I've found so far... not great but at least it has the names and the icons together 到目前为止,这是我找到的最好的参考资料……虽然不好,但至少它包含名称和图标

Cupertino Icons class Cupertino图标类

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM