swipeAngle property

SwipeAngle get swipeAngle

Method to get the swipe angle.

This method returns the angle of the swipe based on the velocity.

Implementation

SwipeAngle get swipeAngle {
  final double dx = velocity.pixelsPerSecond.dx;
  final double dy = velocity.pixelsPerSecond.dy;
  // Add logic here to convert the angle to a SwipeAngle enum.
  if (dx.abs() > dy.abs()) {
    // Horizontal swipe
    return SwipeAngle.horizontal;
  } else if (dy.abs() > dx.abs()) {
    // Vertical swipe
    return SwipeAngle.vertical;
  } else {
    // Diagonal swipe
    return SwipeAngle.diagonal;
  }
}