Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter change the child icon color of FloatingActionButton

Tags:

flutter

dart

I'm new to Flutter and was trying to change the child icon color of FloatingActionButton. Child icon color is white by default.

How can i change that??

Given below is the code that i have worked on.

floatingActionButton: new FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: new Icon(Icons.add),
        backgroundColor: Colors.yellow,

      ), // This trailing comma makes auto-formatting nicer for build methods.
    ); 

Thank you.

like image 918
Sachin Varma Avatar asked Jun 05 '18 07:06

Sachin Varma


People also ask

How do you change action icon color in flutter?

Steps to change icon button color in FlutterLocate the file where you have placed the IconButton widget. Inside the IconButton widget, add the color parameter and assign the color of your choice. Run the App.

How can I change the color of my Icons?

To change the color of an icon, select the icon you'd like to edit. The Format tab will appear. Then click Graphics Fill and select a color from the drop-down menu. To add an outline to your icon, click Shape Outline and select a color from the drop-down menu.

How do I add Icons to my child flutter?

How to Add Icon in Flutter App? You can use Icon() widget to add icons to your Flutter App. You have to pass the icon data as an icon to this widget. You can use default available Material icons with Icons class.


1 Answers

To change the color of child Icon, You have to set the color in the Icon() widget.

Here I am sharing the code snippet where I have set the red color.

floatingActionButton: FloatingActionButton(
        tooltip: 'Increment',
        child: new Icon(Icons.add, color: Colors.red,),
        backgroundColor: Colors.yellow,
      ),
like image 155
Dhrumil Shah - dhuma1981 Avatar answered Sep 21 '22 16:09

Dhrumil Shah - dhuma1981