inflateBySize method
Returns a new rectangle with all edges moved outwards by the given size
.
This method is similar to Map.inflate
but provides additional horiztonal and vertical control
Left and right edges are moved according to size.width
, while
top and bottom edges are moved according to size.height
.
final rect = Offset.zero & Size.square(100);
final inflated = rect.inflateBySize(Size.square(50));
// inflated.left = -50
// inflated.right = 150
// inflated.top = -50
// inflated.bottom = 150
Implementation
Rect inflateBySize(Size size) => Rect.fromLTRB(left - size.width,
top - size.height, right + size.width, bottom + size.height);