flutter multi icon button
List<Icon> icons = [
ESGIcons.star,
ESGIcons.crown,
];
int buttonOnPressed = -1;
ListView.builder(
scrollDirection : Axis.horizontal,
shrinkWrap: true,
itemCount: icons.length,
itemBuilder: (BuildContext context, int index) {
return IconButton(
iconSize: 25,
onPressed: () {
setState(() {
buttonOnPressed = index;
});
},
icon: Icon(icons[index]),
color: (buttonOnPressed == index)
? AppTheme.esgEasyYellow
: AppTheme.esgDarkBlue,
);
});