📅  最后修改于: 2022-03-11 14:55:39.032000             🧑  作者: Mango
List 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,
);
});