horizontalDragEnd method

void horizontalDragEnd(
  1. DragEndDetails details
)

Function for onPanEnd when the dragAxis is DragAxis.horizontal.

Implementation

void horizontalDragEnd(DragEndDetails details) {
  final velocity = details.velocity.pixelsPerSecond.dx.abs();
  if (velocity >= 100) {
    isFront = !isFrontStart;
  }

  animationHorizontal = Tween<double>(
    begin: dragHorizontal,
    end: isFront ? (dragHorizontal > 180 ? 360 : 0) : 180,
  ).animate(animationController);
  animationController.forward(from: 0);
}