overflow method

EdgeInsets overflow(
  1. Rect other
)

Returns the intersection of this rectangle and the given rectangle. The resulting padding will return 0.0 for all values where the rectangles do not overlap. Each overflow will be positive in it's direction.

Implementation

EdgeInsets overflow(Rect other) {
  final double top = ((this.top - other.top) * (-1)).clamp(0, double.infinity);
  final double left = ((this.left - other.left) * (-1)).clamp(0, double.infinity);
  final double bottom = ((other.bottom - this.bottom) * (-1)).clamp(0, double.infinity);
  final double right = ((other.right - this.right) * (-1)).clamp(0, double.infinity);
  return EdgeInsets.fromLTRB(left, top, right, bottom);
}