normalizedGrowthDirection property

GrowthDirection normalizedGrowthDirection

Return what the growthDirection would be if the axisDirection was either AxisDirection.down or AxisDirection.right.

This is the same as growthDirection unless the axisDirection is either AxisDirection.up or AxisDirection.left, in which case it is the opposite growth direction.

This can be useful in combination with axis to view the axisDirection and growthDirection in different terms.

Implementation

GrowthDirection get normalizedGrowthDirection {
  if (axisDirectionIsReversed(axisDirection)) {
    return switch (growthDirection) {
      GrowthDirection.forward => GrowthDirection.reverse,
      GrowthDirection.reverse => GrowthDirection.forward,
    };
  }
  return growthDirection;
}