height static method

double height(
  1. double designedHeight, {
  2. double? maxHeight,
})

return a reasonable height value.

if maxHeight is null then the value will be at most designedHeight logical pixel otherwise, the value will be at most maxHeight logical pixels.

value can be any double between zero and maximum height.

Implementation

static double height(
  double designedHeight, {
  double? maxHeight,
}) {
  final orientation = _orientation;
  if (orientation == Orientation.portrait) {
    final _height = _screenHeight * designedHeight / _designedDeviceHeight;
    if (maxHeight == null) {
      if (_height <= designedHeight) {
        return _height;
      } else {
        return designedHeight;
      }
    } else {
      return _comparator(
        value: _height,
        maxValue: maxHeight,
      );
    }
  } else {
    final _height = _screenHeight * designedHeight / _designedDeviceWidth;
    if (maxHeight == null) {
      if (_height <= designedHeight) {
        return _height;
      } else {
        return designedHeight;
      }
    } else {
      return _comparator(
        value: _height,
        maxValue: maxHeight,
      );
    }
  }
}