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.
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.
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 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.
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,
),
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With