FractionalOffset.fromOffsetAndSize constructor

FractionalOffset.fromOffsetAndSize(
  1. Offset offset,
  2. Size size
)

Creates a fractional offset from a specific offset and size.

The returned FractionalOffset describes the position of the Offset in the Size, as a fraction of the Size.

Implementation

factory FractionalOffset.fromOffsetAndSize(Offset offset, Size size) {
  assert(size != null);
  assert(offset != null);
  return FractionalOffset(
    offset.dx / size.width,
    offset.dy / size.height,
  );
}