deflate method

BoxConstraints deflate (EdgeInsets edges)

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

Implementation

BoxConstraints deflate(EdgeInsets edges) {
  assert(edges != null);
  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)
  );
}