getDefaultCrossAxisDirection method

AxisDirection getDefaultCrossAxisDirection (BuildContext context, AxisDirection axisDirection)

Given a BuildContext and an AxisDirection, determine the correct cross axis direction.

This depends on the Directionality if the axisDirection is vertical; otherwise, the default cross axis direction is downwards.

Implementation

static AxisDirection getDefaultCrossAxisDirection(BuildContext context, AxisDirection axisDirection) {
  assert(axisDirection != null);
  switch (axisDirection) {
    case AxisDirection.up:
      return textDirectionToAxisDirection(Directionality.of(context));
    case AxisDirection.right:
      return AxisDirection.down;
    case AxisDirection.down:
      return textDirectionToAxisDirection(Directionality.of(context));
    case AxisDirection.left:
      return AxisDirection.down;
  }
  return null;
}