bothDragEnd method
Function for onPanEnd when the dragAxis
is DragAxis.both.
Implementation
void bothDragEnd(DragEndDetails details) {
final yVelocity = details.velocity.pixelsPerSecond.dy.abs();
final xVelocity = details.velocity.pixelsPerSecond.dx.abs();
if ((yVelocity >= 100) || (xVelocity >= 100)) {
isFront = !isFrontStart;
if (yVelocity > xVelocity) {
isInverted = !isInverted;
}
}
animationVertical = Tween<double>(
begin: dragVertical,
end: isInverted ? 180 : (dragVertical > 180 ? 360 : 0),
).animate(animationController);
animationHorizontal = Tween<double>(
begin: dragHorizontal,
end: isFront
? (isInverted ? 180 : (dragHorizontal > 180 ? 360 : 0))
: isInverted
? (dragHorizontal > 180 ? 360 : 0)
: 180,
).animate(animationController);
animationController.forward(from: 0);
}