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 {
  assert(axisDirection != null);
  switch (axisDirection) {
    case AxisDirection.down:
    case AxisDirection.right:
      return growthDirection;
    case AxisDirection.up:
    case AxisDirection.left:
      switch (growthDirection) {
        case GrowthDirection.forward:
          return GrowthDirection.reverse;
        case GrowthDirection.reverse:
          return GrowthDirection.forward;
      }
      return null;
  }
  return null;
}