getScaledHeight method

double getScaledHeight()

Implementation

double getScaledHeight() {
  // If widget should resize, use screenHeight.
  if (activeBreakpointSegment.responsiveBreakpoint.isResize) {
    return screenHeight /
        activeBreakpointSegment.responsiveBreakpoint.scaleFactor;
  }

  // Screen is larger than max width. Calculate height
  // from max width.
  if (maxWidth != null) {
    if (activeBreakpointSegment.breakpoint > maxWidth!) {
      return screenHeight /
          activeBreakpointSegment.responsiveBreakpoint.scaleFactor;
    }
  }

  // Find width adjustment scale to proportionally scale height.
  // If screenWidth is scaled 1.5x larger than the breakpoint,
  // decrease screenHeight by 33.33% to proportionally scale content.
  double widthScale =
      screenWidth / activeBreakpointSegment.responsiveBreakpoint.breakpoint;
  // Scale height with width scale and scale factor applied.
  return screenHeight /
      widthScale /
      activeBreakpointSegment.responsiveBreakpoint.scaleFactor;
}