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: clampDouble(minWidth, constraints.minWidth, constraints.maxWidth),
    maxWidth: clampDouble(maxWidth, constraints.minWidth, constraints.maxWidth),
    minHeight: clampDouble(minHeight, constraints.minHeight, constraints.maxHeight),
    maxHeight: clampDouble(maxHeight, constraints.minHeight, constraints.maxHeight),
  );
}