所以我安装了一个动画文本工具包,但我遇到了一些无法解决的问题,动画淡入、缩小、然后淡出、缩小。我希望它淡出并缩小并停留在那里,我该怎么做?(我尝试用谷歌搜索但没有运气)
谢谢你!
所以我做了一个计时器,想知道如何添加一个“发光”,使其动画/变大一点,然后回到较小的发光。另一个问题是,当我启动计时器时,它每秒都会更新(有点跳跃而不是流动)
不知道如何继续这个,因为现在尝试谷歌几个小时但没有运气。
感谢您的帮助!
这是我的代码
var maxSeconds = 900;
late int seconds = maxSeconds;
Timer? timer;
void resetTimer() {
setState(() => seconds = maxSeconds);
timer = null;
}
void startTimer({bool reset = true}) {
if (reset) {
resetTimer();
}
timer = Timer.periodic(Duration(seconds: 1), (_) {
if (!mounted) // Putting this line of code with return under, fixed my issue i been having about mounted
return;
else if (seconds > 0) {
setState(() => seconds--);
} else {
stopTimer(reset: false);
}
}); …Run Code Online (Sandbox Code Playgroud)