tighten method

BoxConstraints tighten ({double width, 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.


BoxConstraints tighten({ double width, double height }) {
  return new 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));