toHeight static method

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

Implementation

static double? toHeight(PosSizeModel? posSizeModel, BuildContext context,
    Orientation orientation) {
  if (posSizeModel == null) return null;
  if (orientation == Orientation.landscape) {
    if (posSizeModel.heightLandscape == null) return null;
    if (posSizeModel.heightLandscape == 0) return null;
    if (posSizeModel.heightTypeLandscape ==
        HeightTypeLandscape.absoluteHeight) {
      return posSizeModel.heightLandscape;
    }
    return fullScreenHeight(context) * posSizeModel.heightLandscape!;
  } else {
    if (posSizeModel.heightPortrait == 0) return null;
    if (posSizeModel.heightPortrait == null) return null;
    if (posSizeModel.heightTypePortrait ==
        HeightTypePortrait.absoluteHeight) {
      return posSizeModel.heightPortrait;
    }
    return fullScreenHeight(context) * posSizeModel.heightPortrait!;
  }
}