copyWith method

Rect copyWith(
  1. {int? x,
  2. int? y,
  3. int? width,
  4. int? height}
)

Returns a copy of this rectangle with the given arguments replaced.

If no arguments are given, the original rectangle is returned.

Implementation

Rect copyWith({
  int? x,
  int? y,
  int? width,
  int? height,
}) {
  return Rect.fromLTWH(
    x ?? this.x,
    y ?? this.y,
    width ?? this.width,
    height ?? this.height,
  );
}