closeWithAnim method

Future<void> closeWithAnim()

close this cell and return the Future of the animation

Implementation

Future<void> closeWithAnim() async {
  //when close animation is running,ignore action button hit test
  ignoreActionButtonHit = true;
  _resetAnimValue();
  if (mounted) {
    animation = Tween<double>(begin: currentOffset.dx, end: 0.0)
        .animate(closeCurvedAnim)
      ..addListener(() {
        if (lockAnim) return;
        this.currentOffset = Offset(animation.value, 0);
        setState(() {});
      });

    controller.duration =
        Duration(milliseconds: widget.closeAnimationDuration);
    return controller.forward()
      ..whenCompleteOrCancel(() {
        ignoreActionButtonHit = false;
      });
  }
}