RelativeRect.fromSize constructor

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.

Implementation

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