【问题标题】:Flutter Material icons: some icons dont exist in the flutter's Icons classFlutter Material 图标:flutter Icons 类中不存在一些图标
【发布时间】:2024-01-15 11:01:01
【问题描述】:

我意识到这是 this question 的重复,但该问题似乎没有任何活动,因此我正试图让更多人关注这个问题。

我正在尝试使用 Material 图标中的 percent 图标,尽管在 fonts.google.com 网站中,它显示了颤振实现(截图附在下面),当我尝试从颤振代码调用它时,我得到了错误The getter 'percent' isn't defined for the type 'Icons'.(下面附上截图)。

这是什么原因,为什么谷歌试图显示某些图标支持颤振,而它显然不支持?

这是我的flutter doctor -v 输出:

[√] Flutter (Channel stable, 2.8.0, on Microsoft Windows [Version 10.0.19041.1348], locale en-US)
    • Flutter version 2.8.0 at C:\Users\adnan\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision cf44000065 (23 hours ago), 2021-12-08 14:06:50 -0800
    • Engine revision 40a99c5951
    • Dart version 2.15.0
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at C:\Users\adnan\AppData\Local\Android\sdk
    • Platform android-31, build-tools 30.0.3
    • Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java     
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)    
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 2020.3)
    • Android Studio at C:\Program Files\Android\Android Studio1
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[!] Android Studio (version 4.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    X Unable to determine bundled Java version.
    • Try updating or re-installing Android Studio.

[√] VS Code (version 1.62.3)
    • VS Code at C:\Users\adnan\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.29.0

[√] VS Code (version 1.61.0-insider)
    • VS Code at C:\Users\adnan\AppData\Local\Programs\Microsoft VS Code Insiders
    • Flutter extension can be installed from:
       https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[√] Connected device (3 available)
    • sdk gphone x86 (mobile) • emulator-5554 • android-x86    • Android 11 (API 30) (emulator)
    • Chrome (web)            • chrome        • web-javascript • Google Chrome 96.0.4664.45
    • Edge (web)              • edge          • web-javascript • Microsoft Edge 96.0.1054.43

! Doctor found issues in 1 category.

【问题讨论】:

  • 我会使用this 列表。还要确保在你的pubsec.yamlflutter: uses-material-design: true
  • 如果您想使用最新的素材图标,可以使用this lib

标签: flutter material-design google-material-icons


【解决方案1】:

显然,现在有了Flutter 2.10,他们添加了一些图标。

Last but not least, we’ve added 1,028 new Material icons.

这有点回答了这个问题,所以明确的答案是每当我们遇到这样的问题时,我们只能坐等flutter整合这些图标,或者使用另一个Icons包。

【讨论】:

    最近更新 更多