toWidth static method

double? toWidth(
  1. PosSizeModel? posSizeModel,
  2. BuildContext context,
  3. Orientation orientation
)

Implementation

static double? toWidth(PosSizeModel? posSizeModel, BuildContext context,
    Orientation orientation) {
  if (posSizeModel == null) return null;
  if (orientation == Orientation.landscape) {
    if (posSizeModel.widthLandscape == 0) return null;
    if (posSizeModel.widthLandscape == null) return null;
    if (posSizeModel.widthTypeLandscape == WidthTypeLandscape.absoluteWidth) {
      return posSizeModel.widthLandscape;
    }
    return fullScreenWidth(context) * posSizeModel.widthLandscape!;
  } else {
    if (posSizeModel.widthPortrait == 0) return null;
    if (posSizeModel.widthPortrait == null) return null;
    if (posSizeModel.widthTypePortrait == WidthTypePortrait.absoluteWidth) {
      return posSizeModel.widthPortrait;
    }
    return fullScreenWidth(context) * posSizeModel.widthPortrait!;
  }
}