deleteWithAnim method

Future<void> deleteWithAnim()

delete this cell and return the Future of the animation

Implementation

Future<void> deleteWithAnim() async {
  animation = Tween<double>(begin: 1.0, end: 0.01).animate(deleteCurvedAnim)
    ..addListener(() {
      /// When quickly click the delete button,the animation will not be seen
      /// so the code below is to solve this problem....
      if (whenTrailingActionShowing) {
        currentOffset = Offset(-maxTrailingPullWidth, 0);
      } else if (whenLeadingActionShowing) {
        currentOffset = Offset(maxLeadingPullWidth, 0);
      }
    });

  return deleteController.reverse()
    ..whenCompleteOrCancel(() {
      SwipeActionStore.getInstance()
          .bus
          .fire(IgnorePointerEvent(ignore: false));
    });
}