intersection method

Rect? intersection(
  1. Rect other
)

Implementation

Rect? intersection(Rect other) {
  if (!overlaps(other)) return null;
  final l = math.max(left, other.left);
  final r = math.min(right, other.right);
  final t = math.max(top, other.top);
  final b = math.min(bottom, other.bottom);
  return (r > l && b > t) ? Rect.fromLTRB(l, t, r, b) : null;
}