contains method
Returns true
if this rectangle contains the rectangle x
,y
, width
,height
.
Implementation
bool contains(num x, num y, num width, num height) {
final mx = this.x;
final my = this.y;
final mw = this.width;
final mh = this.height;
return width > 0 &&
height > 0 &&
mw > 0 &&
mh > 0 &&
x >= mx &&
(x + width) <= (mx + mw) &&
y >= my &&
(y + height) <= (my + mh);
}