【发布时间】: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