applyGrowthDirectionToAxisDirection function

AxisDirection applyGrowthDirectionToAxisDirection(
  1. AxisDirection axisDirection,
  2. 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) {
  switch (growthDirection) {
    case GrowthDirection.forward:
      return axisDirection;
    case GrowthDirection.reverse:
      return flipAxisDirection(axisDirection);
  }
}