Flutter小技巧
作者:
小青蛙的花 | 来源:发表于
2023-11-01 10:13 被阅读0次1.动画重复给定的次数
late AnimationController _controller;
late Animation _animation;
@override
void initState() {
// TODO: implement initState
super.initState();
_controller = AnimationController(vsync: this, duration: Duration(milliseconds: 100));
_controller.addListener(() => setState(() {}));
_animation = Tween(begin: 0.0, end: 16.0).animate(_controller);
}
// 执行动画,1秒后超时取消
TickerFuture tickerFuture = _controller.repeat(reverse: true);
tickerFuture.timeout(Duration(seconds: 1), onTimeout: () {
_controller.stop(canceled: true);
});
本文标题:Flutter小技巧
本文链接:https://www.haomeiwen.com/subject/bznwidtx.html
网友评论