flipScrollDirection function

ScrollDirection flipScrollDirection(
  1. 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) {
  return switch (direction) {
    ScrollDirection.idle    => ScrollDirection.idle,
    ScrollDirection.forward => ScrollDirection.reverse,
    ScrollDirection.reverse => ScrollDirection.forward,
  };
}