how to add icon to elevated button in flutter code example
Example 1: flutter change the icon of icon button on pressed
bool selected = true;
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: IconButton(
icon: Icon( selected ? Icons.celebration : Icons.title),
onPressed: () {
setState(() {
selected = !selected;
});
},
),
),
);
}
Example 2: flutter raised button with icon
FlatButton.icon(onPressed: null, icon: null, label: null);
RaisedButton.icon(onPressed: null, icon: null, label: null);