enforce method

BoxConstraints enforce (
  1. BoxConstraints constraints
)

Returns new box constraints that respect the given constraints while being as close as possible to the original constraints.

Implementation

BoxConstraints enforce(BoxConstraints constraints) {
  return BoxConstraints(
    minWidth: minWidth.clamp(constraints.minWidth, constraints.maxWidth) as double,
    maxWidth: maxWidth.clamp(constraints.minWidth, constraints.maxWidth) as double,
    minHeight: minHeight.clamp(constraints.minHeight, constraints.maxHeight) as double,
    maxHeight: maxHeight.clamp(constraints.minHeight, constraints.maxHeight) as double,
  );
}