flipScrollDirection function

ScrollDirection flipScrollDirection (ScrollDirection direction)

Returns the opposite of the given ScrollDirection.

Specifically, returns ScrollDirection.reverse for ScrollDirection.forward (and vice versa) and returns ScrollDirection.idle for ScrollDirection.idle.

Implementation

ScrollDirection flipScrollDirection(ScrollDirection direction) {
  switch (direction) {
    case ScrollDirection.idle:
      return ScrollDirection.idle;
    case ScrollDirection.forward:
      return ScrollDirection.reverse;
    case ScrollDirection.reverse:
      return ScrollDirection.forward;
  }
  return null;
}