swipeMagnitude property
Method to get the swipe magnitude.
This method returns the magnitude of the swipe based on the velocity. Audited: 2026-06-12 11:26 EDT
Implementation
@useResult
SwipeMagnitude get swipeMagnitude {
final double magnitude = velocity.pixelsPerSecond.distance;
// Add logic here to convert the magnitude to a SwipeMagnitude enum.
if (magnitude < (GestureUtils.swipeMagnitudeThresholds[SwipeMagnitude.minimal] ?? 0)) {
return SwipeMagnitude.minimal;
}
if (magnitude < (GestureUtils.swipeMagnitudeThresholds[SwipeMagnitude.small] ?? 0)) {
return SwipeMagnitude.small;
}
if (magnitude < (GestureUtils.swipeMagnitudeThresholds[SwipeMagnitude.medium] ?? 0)) {
return SwipeMagnitude.medium;
}
if (magnitude < (GestureUtils.swipeMagnitudeThresholds[SwipeMagnitude.large] ?? 0)) {
return SwipeMagnitude.large;
}
return SwipeMagnitude.massive;
}