expandBySize method
Returns a new rectangle with only the right and bottom edges moved outwards by the given size
.
This method is similar to Map.inflateBySize
but pins the top-left corner of the Rect
The right edge is moved according to size.width
, doubled, while
The bottom edge is moved according to size.height
, doubled.
final rect = Offset.zero & Size.square(100);
final expanded = rect.inflateBySize(Size.square(50));
// expanded.left = 0
// expanded.right = 200
// expanded.top = 0
// expanded.bottom = 200
Implementation
Rect expandBySize(Size size) => Rect.fromLTRB(
left, top, right + size.width * 2, bottom + size.height * 2);