toBoxFit static method

BoxFit? toBoxFit(
  1. PosSizeModel? posSizeModel,
  2. Orientation orientation
)

Implementation

static BoxFit? toBoxFit(PosSizeModel? posSizeModel, Orientation orientation) {
  if (posSizeModel == null) return null;
  if (orientation == Orientation.landscape) {
    switch (posSizeModel.fitLandscape) {
      case LandscapeFitType.landscapeFitWidth:
        return BoxFit.fitWidth;
      case LandscapeFitType.landscapeFitHeight:
        return BoxFit.fitHeight;
      case LandscapeFitType.landscapeFill:
        return BoxFit.fill;
      case LandscapeFitType.landscapeNone:
        return BoxFit.none;
      case LandscapeFitType.landscapeContain:
        return BoxFit.contain;
      case LandscapeFitType.landscapeCover:
        return BoxFit.cover;
      case LandscapeFitType.landscapeScaleDown:
        return BoxFit.scaleDown;
      case LandscapeFitType.unknown:
        return null;
      case null:
        return null;
    }
  } else {
    switch (posSizeModel.fitPortrait) {
      case PortraitFitType.portraitFitWidth:
        return BoxFit.fitWidth;
      case PortraitFitType.portraitFitHeight:
        return BoxFit.fitHeight;
      case PortraitFitType.portraitFill:
        return BoxFit.fill;
      case PortraitFitType.portraitNone:
        return BoxFit.none;
      case PortraitFitType.portraitContain:
        return BoxFit.contain;
      case PortraitFitType.portraitCover:
        return BoxFit.cover;
      case PortraitFitType.portraitScaleDown:
        return BoxFit.scaleDown;
      case PortraitFitType.unknown:
        return null;
      case null:
        return null;
    }
  }
}