swipeAngle property

  1. @useResult
SwipeAngle get swipeAngle

Method to get the swipe angle.

This method returns the angle of the swipe based on the velocity. Audited: 2026-06-12 11:26 EDT

Implementation

@useResult
SwipeAngle get swipeAngle {
  final double velocityX = velocity.pixelsPerSecond.dx;
  final double velocityY = velocity.pixelsPerSecond.dy;

  if (velocityX.abs() > velocityY.abs()) {
    return SwipeAngle.horizontal;
  }

  if (velocityY.abs() > velocityX.abs()) {
    return SwipeAngle.vertical;
  }

  return SwipeAngle.diagonal;
}