applyGrowthDirectionToAxisDirection function

AxisDirection applyGrowthDirectionToAxisDirection (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.


AxisDirection applyGrowthDirectionToAxisDirection(AxisDirection axisDirection, GrowthDirection growthDirection) {
  assert(axisDirection != null);
  assert(growthDirection != null);
  switch (growthDirection) {
    case GrowthDirection.forward:
      return axisDirection;
    case GrowthDirection.reverse:
      return flipAxisDirection(axisDirection);
  return null;