getHeight method

double getHeight(
  1. double? percentage
)

Returns the height equivalent of the percentage provided.

Implementation

double getHeight(double? percentage) {
  final int _decPlaces = 5;

  _screenHeight = _screenHeight
      .floorToDouble(); // Extracts Device Screen maximum percentage.

  double _rsHeight = 0;
  if (_screenHeight == _fixedHeight) {
    // If input percentage matches fixedHeight then do normal scaling.
    _rsHeight =
        _roundToDecimals((_screenHeight * (percentage! / 100)), _decPlaces);
  } else {
    // If input percentage !match fixedHeight then do adjustment factor scaling.
    double _scaleRatioHeight =
        _roundToDecimals((_screenHeight / _fixedHeight), _decPlaces);
    double _scalerHeight =
        ((percentage! + log(percentage + 1)) * pow(1, _scaleRatioHeight)) /
            100;
    _rsHeight = _roundToDecimals((_screenHeight * _scalerHeight), _decPlaces);
  }

  return _screenHeight * percentage/100;
}