Flutter – Slidable, cannot put svg for icon property of Slidable

      groupTag: 0,
      key: UniqueKey(),
      endActionPane: ActionPane(
        children: [
            onPressed: (BuildContext context) {
                //whatever I will do here
            icon: Icons.delete
          )// SvgPicture.asset(Assets.svg.trash.svg()),)
      child: _makeColumnTile(


This is just a basic slidable item, which I am doing for every list item I have. I understand, and can work with slidable and listTile. However, I want to put my own custom svg file I saved in my assets folder, not pre-built Icons. But the icon: is apparently only wanting IconData

I tried putting svg directly with SvgPicture.asset(Assets.svg.trash.svg()), but the error is

The argument type SvgPicture can’t be assigned to the parameter type IconData?,

also when I want to assign Icon to icon, this error pops up.

The argument type ‘Icon’ can’t be assigned to the parameter type ‘IconData?.

I understand why I cannot assign those properties, but isn’t there any way I could solve this problem?

>Solution :

The SlidableAction only accepts IconData in its icon property. A list of MaterialIcons is available here.

   icon: Icons.archive,

For your use case, you can instead use a CustomSlidableAction (check the package’s API reference here).

CustomSlidableAction (
  child: //Your action's icon or label.

You can pass your SVG as a child to it.

Leave a Reply Cancel reply