RelativeRect.fromSize(Rect rect, Size container)

Creates a RelativeRect from a Rect and a Size. The Rect (first argument) and the RelativeRect (the output) are in the coordinate space of the rectangle described by the Size, with 0,0 being at the top left.

Source

factory RelativeRect.fromSize(Rect rect, Size container) {
  return new RelativeRect.fromLTRB(rect.left, rect.top, container.width - rect.right, container.height - rect.bottom);
}