Answers for "how to replace favourite iconbutton on pressed with filled red colors favourite iconbutton in flutter?"

0

flutter IconButton change color onPressed

class SomeState extends State<StatefulWidget> {
  Color _iconColor = Colors.white;

  @override
  Widget build(BuildContext) {
    return ListTile(
      leading: new IconButton(
        icon: Icon(Icons.star, color: _iconColor),
        onPressed: () {
          setState(() {
          _iconColor = Colors.yellow;
        });
      },
    );
  }
}
Posted by: Guest on August-12-2021

Code answers related to "how to replace favourite iconbutton on pressed with filled red colors favourite iconbutton in flutter?"

Code answers related to "Dart"

Browse Popular Code Answers by Language