【问题标题】:How to use book_outlined icon in flutter?如何在颤动中使用 book_outlined 图标?
【发布时间】:2020-10-22 02:05:51
【问题描述】:

我想在 Flutter 中使用“book_outlined”图标,但它没有显示在我的应用中。

book_outlined:https://api.flutter.dev/flutter/material/Icons/book_outlined-constant.html

我尝试了两种方式,但总是出错。

// 1
Icon(Icons.book_outlined)

//2
Icon(IconData(0xe08f, fontFamily: 'MaterialIcons'))

The getter 'book_outlined' isn't defined for the type 'Icons'.
Try importing the library that defines 'book_outlined', correcting the name to the name of an existing getter, or defining a getter or field named 'book_outlined'

我的代码有什么错误吗? 请给我一些建议好吗?

【问题讨论】:

  • 这可能是一个颤振版本的问题,那个图标可能是一个新的。你的 Flutter 是什么版本的?
  • 我认为我的版本是 1.17.1 flutter --version Flutter 1.17.1
  • 是的,我认为将其更新到最新版本将解决问题。但是想想有这么多不推荐使用的方法、小部件等,它可能会导致您的项目出现一些错误。
  • 好的,我明白了。谢谢你的建议!

标签: flutter icons material-design


【解决方案1】:

如果更新您的 Flutter 版本没有帮助,那么您可以切换到主频道。我刚刚检查过,上面的图标在那里可用。要切换频道,只需输入命令:flutter channel master

【讨论】:

  • 切换到主频道并提取最新更改对我有用。
猜你喜欢
  • 1970-01-01
  • 2020-09-05
  • 1970-01-01
  • 2021-03-31
  • 1970-01-01
  • 2019-08-05
  • 2020-04-20
  • 2018-10-08
  • 1970-01-01
相关资源
最近更新 更多