Search code examples
flutterdartwidgeticons

SlideAction Icon color need to change - Flutter


Using below package in Flutter : https://pub.dev/packages/flutter_slidable/example

There in code you will find below widget:

SlidableAction(
                onPressed: doNothing,
                backgroundColor: Color(0xFF0392CF),
                foregroundColor: Colors.white,
                icon: Icons.save,
                label: 'Save',
              ),

Now Please note that icon property has Icons.save which is inbuilt and coming from flutter inbuilt sdk package.

Now, I want to change the color of that Icon. I have tried using Icons() widget but it only accept Icons.any_inbuild_icon name as a value.

How can I change the color of that Slidable Icon? Thanks in advance.


Solution

  • foregroundColor is the color of the icon. so change the value of foreground and it works for me.

    foregroundColor: Colors.white,

    CHANGE TO WHATEVER COLOR YOU WANT example: Colors.red or pass hex value Color(0xDE00FF00)

    VIEW CODE

    VIEW RESULT