applyGrowthDirectionToScrollDirection function
Flips the ScrollDirection if the GrowthDirection is GrowthDirection.reverse.
Specifically, returns scrollDirection
if scrollDirection
is
GrowthDirection.forward, otherwise returns flipScrollDirection applied to
scrollDirection
.
This function is useful in RenderSliver subclasses that are given both an ScrollDirection and a GrowthDirection and wish to compute the ScrollDirection in which growth will occur.
Implementation
ScrollDirection applyGrowthDirectionToScrollDirection(ScrollDirection scrollDirection, GrowthDirection growthDirection) {
assert(scrollDirection != null);
assert(growthDirection != null);
switch (growthDirection) {
case GrowthDirection.forward:
return scrollDirection;
case GrowthDirection.reverse:
return flipScrollDirection(scrollDirection);
}
return null;
}