问题描述
我发现有关每隔几秒钟或几秒钟后更改背景的问题。不知道晚上是否太晚或我的情况是否有所不同。发生特定事件时,我想将容器的背景颜色更改1秒。
setState(() {
flashBackground = (answer == result ? false : true);
Timer(Duration(seconds: 1),() {flashBackground = false;});
});
这会触发容器的背景
color: (flashBackground ? CupertinoColors.destructiveRed : CupertinoColors.white)
当flashBackground设置为true时,背景变为破坏性红色(我喜欢它),但是此后计时器不会将颜色恢复为白色。我在做什么错了?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)