Rect inscribe(Size size, Rect rect)

Returns a rect of the given size, centered at this fraction of the given rect.

For example, a 100×100 size inscribed on a 200×200 rect using FractionalOffset.topLeft would be the 100×100 rect at the top left of the 200×200 rect.

Source

Rect inscribe(Size size, Rect rect) {
  return new Rect.fromLTWH(
    rect.left + (rect.width - size.width) * dx,
    rect.top + (rect.height - size.height) * dy,
    size.width,
    size.height
  );
}