【发布时间】:2021-10-26 17:07:47
【问题描述】:
我想在big_button_example.dart 文件中的AnimatedIconItem 使用图像资源animated_icon_button 颤振库。您可以在pub.dev 上找到该库。 SimpleIcons 用于图标。原代码是:
AnimatedIconItem(
icon: Icon(SimpleIcons.nasa, color: color),
backgroundColor: Colors.white,
),
我想将图像资源用于图标变量。我试过这些:
icon: ImageIcon(
AssetImage("images/icon.png"),
color: Color(0xFF3A5A98),
),
icon: Image.asset('assets/icon.png'),
icon: IconButton(
icon: Image.asset('assets/icon.png'),
),
但我总是遇到像The argument type 'ImageIcon' can't be assigned to the parameter type 'Icon' 这样的错误。如何将图像用于 Icon?
【问题讨论】:
-
我发现它只需要
Icon类型的数据。而Icon只能有IconData。
标签: flutter