normalize method

BoxConstraints normalize()

Returns a box constraints that isNormalized.

The returned maxWidth is at least as large as the minWidth. Similarly, the returned maxHeight is at least as large as the minHeight.

Implementation

BoxConstraints normalize() {
  if (isNormalized) {
    return this;
  }
  final double minWidth = this.minWidth >= 0.0 ? this.minWidth : 0.0;
  final double minHeight = this.minHeight >= 0.0 ? this.minHeight : 0.0;
  return BoxConstraints(
    minWidth: minWidth,
    maxWidth: minWidth > maxWidth ? minWidth : maxWidth,
    minHeight: minHeight,
    maxHeight: minHeight > maxHeight ? minHeight : maxHeight,
  );
}