scrollDirection function

GestureDirection? scrollDirection(
  1. num deltaX,
  2. num deltaY
)

Implementation

GestureDirection? scrollDirection(num deltaX, num deltaY) {
  num deltaXAbs = deltaX.abs();
  num deltaYAbs = deltaY.abs();
  if (deltaY >= deltaXAbs) {
    return GestureDirection.up;
  } else if (deltaY <= -deltaXAbs) {
    return GestureDirection.down;
  } else if (deltaX > deltaYAbs) {
    return GestureDirection.right;
  } else if (deltaX < -deltaYAbs) {
    return GestureDirection.left;
  }
  return null;
}