【问题标题】:Circular progress button automatically trigger once the progress is complete进度完成后自动触发圆形进度按钮
【发布时间】:2019-01-23 11:36:00
【问题描述】:

我有一个基于 ontapdown 和 ontapup 的工作循环进度按钮,但是我希望它在进度完成后触发。现在它只有在进度完成并且用户点击时才会触发。

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);
    });
  }
},

【问题讨论】:

    标签: dart flutter


    【解决方案1】:

    您可以在您的AnimationController 中添加一个侦听器,以便在动画完成时执行一些操作:

    controller1.addStatusListener((status) {
      if (status != AnimationStatus.completed) {
        return;
      }
    
      //Animation is complete! Do completion stuff.
    });
    

    【讨论】:

      猜你喜欢
      • 2019-04-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多