getMaxWidth method

double? getMaxWidth({
  1. double? widthParent,
})

Implementation

double? getMaxWidth({double? widthParent})
{
  double? width;

  // width
  if (maxWidth != null)
  {
    width = maxWidth;
  }

  // percentage width based on parent
  else if (maxWidthPercentage != null && widthParent != null)
  {
    width = ((maxWidthPercentage!/100) * widthParent);
  }

  // cannot be negative
  if (width != null && width.isNegative)
  {
    width = 0;
  }

  return width;
}