mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Add overlaps method to Rect (#4150)
* Add overlaps method to Rect * review comment
This commit is contained in:
parent
a0313d1019
commit
bdfedcc26f
@ -653,6 +653,15 @@ class Rect {
|
||||
);
|
||||
}
|
||||
|
||||
/// Whether `other` has a nonzero area of overlap with this rectangle.
|
||||
bool overlaps(Rect other) {
|
||||
if (right <= other.left || other.right <= left)
|
||||
return false;
|
||||
if (bottom <= other.top || other.bottom <= top)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// The lesser of the magnitudes of the width and the height of this
|
||||
/// rectangle.
|
||||
double get shortestSide {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user