deflate method

BoxConstraints deflate(
  1. EdgeInsetsGeometry edges
)

Returns new box constraints that are smaller by the given edge dimensions.

Implementation

BoxConstraints deflate(EdgeInsetsGeometry edges) {
  assert(debugAssertIsValid());
  final double horizontal = edges.horizontal;
  final double vertical = edges.vertical;
  final double deflatedMinWidth = math.max(0.0, minWidth - horizontal);
  final double deflatedMinHeight = math.max(0.0, minHeight - vertical);
  return BoxConstraints(
    minWidth: deflatedMinWidth,
    maxWidth: math.max(deflatedMinWidth, maxWidth - horizontal),
    minHeight: deflatedMinHeight,
    maxHeight: math.max(deflatedMinHeight, maxHeight - vertical),
  );
}