Want to change the color of Icon when tapped. By default if item if already favorite, Icon is red while others are of default color.
If user taps on Icon to make it favorite or Unfavorite, I want to change the color after update.
new ListTile(
trailing: InkWell(
child: Icon(Icons.share),
),
leading: InkWell(
onTap: () {
snapshot.data[index].isFavorite == 0
? makeFavorite(snapshot.data[index].id)
: makeUnfavorite(
snapshot.data[index].id);
},
child: snapshot.data[index].isFavorite == 1
? Icon(
Icons.favorite,
color: Colors.red,
)
: Icon(Icons.favorite)),
title: new Text(snapshot.data[index].body,
style: new TextStyle(
fontWeight: FontWeight.bold, fontSize: 14.0)),
),