tighten method

BoxConstraints tighten({
  1. double? width,
  2. double? height,
})

Returns new box constraints with a tight width and/or height as close to the given width and height as possible while still respecting the original box constraints.

Implementation

BoxConstraints tighten({double? width, double? height}) {
  return BoxConstraints(
      minWidth: width == null ? minWidth : width.clamp(minWidth, maxWidth),
      maxWidth: width == null ? maxWidth : width.clamp(minWidth, maxWidth),
      minHeight:
          height == null ? minHeight : height.clamp(minHeight, maxHeight),
      maxHeight:
          height == null ? maxHeight : height.clamp(minHeight, maxHeight));
}