applyGrowthDirectionToScrollDirection function
- ScrollDirection scrollDirection,
- GrowthDirection growthDirection
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) {
return switch (growthDirection) {
GrowthDirection.forward => scrollDirection,
GrowthDirection.reverse => flipScrollDirection(scrollDirection),
};
}