applyGrowthDirectionToAxisDirection function
- AxisDirection axisDirection,
- GrowthDirection growthDirection
Flips the AxisDirection if the GrowthDirection is GrowthDirection.reverse.
Specifically, returns axisDirection if growthDirection is
GrowthDirection.forward, otherwise returns flipAxisDirection applied to
axisDirection.
This function is useful in RenderSliver subclasses that are given both an AxisDirection and a GrowthDirection and wish to compute the AxisDirection in which growth will occur.
Implementation
AxisDirection applyGrowthDirectionToAxisDirection(
AxisDirection axisDirection,
GrowthDirection growthDirection,
) {
return switch (growthDirection) {
GrowthDirection.forward => axisDirection,
GrowthDirection.reverse => flipAxisDirection(axisDirection),
};
}