percentageSize method

double percentageSize(
  1. double totalSize,
  2. double percentageSize
)

Calculates the size based on a percentage of the total size.

Example:

double result = sizeConfig.percentageSize(totalSize, percentageSize);

Implementation

double percentageSize(double totalSize, double percentageSize) {
  if (percentageSize > 100) return totalSize;
  if (percentageSize < 0) return 0;
  return totalSize * (percentageSize / 100);
}