📜  颤动多图标按钮 - 任何代码示例

📅  最后修改于: 2022-03-11 14:55:39.032000             🧑  作者: Mango

代码示例1
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,
      );
    });