Answers for "flutter IconButton change color onPressed"

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

Browse Popular Code Answers by Language