contains method

bool contains(
  1. num x,
  2. num y,
  3. num width,
  4. num height,
)

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);
}