constrainedBigWidth function

double constrainedBigWidth(
  1. BuildContext context,
  2. double preferredWidth, {
  3. double? constraintWidth,
})

Method to get preferredWidth constrained, if is smaller than default width, will return constraintWidth if not null, else return media query.

Implementation

double constrainedBigWidth (BuildContext context, double preferredWidth, {double? constraintWidth}) {
  double width = preferredWidth;
  double def = constraintWidth ?? MediaQuery.of(context).size.width;
  if (preferredWidth < def) {
    width = def;
  }

  return width;
}