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 : clampDouble(width, minWidth, maxWidth),
    maxWidth: width == null ? maxWidth : clampDouble(width, minWidth, maxWidth),
    minHeight: height == null ? minHeight : clampDouble(height, minHeight, maxHeight),
    maxHeight: height == null ? maxHeight : clampDouble(height, minHeight, maxHeight),
  );
}