【问题标题】:The argument type 'ImageIcon' can't be assigned to the parameter type 'IconData?'. (Documentation)不能将参数类型 \'ImageIcon\' 分配给参数类型 \'IconData?\'。 (文档)
【发布时间】:2022-12-04 11:37:33
【问题描述】:

I am using a library that requires an icon of type package:flutter/src/widgets/icon_data.dart aka IconData. I\'d like to use my own .png file asset as an icon. I googled for solutions and everybody points out to the usage of ImageIcon. However when using this - the following error appears:

        CircularMenuItem(
            iconColor: GuiColors.textLight,
            color: GuiColors.primary,
            icon: ImageIcon(AssetImage(\"assets/icons/sword.png\")),
            onTap: () {
              //callback
            }),

The error is:

The argument type \'ImageIcon\' can\'t be assigned to the parameter type \'IconData?\'. (Documentation)

    标签: flutter dart flutter-image


    【解决方案1】:
    猜你喜欢
    • 2021-12-15
    • 2020-01-23
    • 1970-01-01
    • 2022-12-22
    • 2021-01-05
    • 2022-06-19
    • 2022-09-28
    • 2022-01-14
    • 2018-12-26
    相关资源
    最近更新 更多