我有一个基于ontapdown和ontapup的循环工作进度按钮,但是我希望它在进度完成后触发。现在,它仅在进度完成并用户点击Up时触发。
onTapDown: (_) {
controller1.forward();
},
onTapUp: (_) {
if (controller1.status ==
AnimationStatus.forward) {
controller1.reverse();
} else if (controller1.status ==
AnimationStatus.completed) {
setState(() {
controller1.value = 0.0;
// widget.isClickCALLBOMBA = true;
// controller1.reverse();
Flushbar()
..title = allTranslations
.text('success')
..message =
"We will alert the bomba !"
..duration =
Duration(seconds: 3)
..backgroundColor =
Colors.red
..show(context);
});
}
},
答案 0 :(得分:0)
您可以在AnimationController
上添加一个侦听器,以在动画制作完成后做一些事情:
controller1.addStatusListener((status) {
if (status != AnimationStatus.completed) {
return;
}
//Animation is complete! Do completion stuff.
});