toAlignment static method

Alignment? toAlignment(
  1. PosSizeModel? posSizeModel,
  2. Orientation orientation
)

Implementation

static Alignment? toAlignment(
    PosSizeModel? posSizeModel, Orientation orientation) {
  if (posSizeModel == null) return null;
  if (orientation == Orientation.landscape) {
    switch (posSizeModel.alignTypeLandscape) {
      case LandscapeAlignType.landscapeAlignTopLeft:
        return Alignment.topLeft;
      case LandscapeAlignType.landscapeAlignTopCenter:
        return Alignment.topCenter;
      case LandscapeAlignType.landscapeAlignTopRight:
        return Alignment.topRight;
      case LandscapeAlignType.landscapeAlignCenterLeft:
        return Alignment.centerRight;
      case LandscapeAlignType.landscapeAlignCenter:
        return Alignment.center;
      case LandscapeAlignType.landscapeAlignCenterRight:
        return Alignment.centerRight;
      case LandscapeAlignType.landscapeAlignBottomLeft:
        return Alignment.bottomLeft;
      case LandscapeAlignType.landscapeAlignBottomCenter:
        return Alignment.bottomCenter;
      case LandscapeAlignType.landscapeAlignBottomRight:
        return Alignment.bottomRight;
      case LandscapeAlignType.unknown:
        return Alignment.bottomRight;
      case null:
        return null;
    }
  } else {
    switch (posSizeModel.alignTypePortrait) {
      case PortraitAlignType.portraitAlignTopLeft:
        return Alignment.topLeft;
      case PortraitAlignType.portraitAlignTopCenter:
        return Alignment.topCenter;
      case PortraitAlignType.portraitAlignTopRight:
        return Alignment.topRight;
      case PortraitAlignType.portraitAlignCenterLeft:
        return Alignment.centerRight;
      case PortraitAlignType.portraitAlignCenter:
        return Alignment.center;
      case PortraitAlignType.portraitAlignCenterRight:
        return Alignment.centerRight;
      case PortraitAlignType.portraitAlignBottomLeft:
        return Alignment.bottomLeft;
      case PortraitAlignType.portraitAlignBottomCenter:
        return Alignment.bottomCenter;
      case PortraitAlignType.portraitAlignBottomRight:
        return Alignment.bottomRight;
      case PortraitAlignType.unknown:
        return Alignment.bottomRight;
      case null:
        return null;
    }
  }
}