withinRect method

Offset withinRect(
  1. Rect rect
)

Returns the point that is this fraction within the given rect.

Implementation

Offset withinRect(Rect rect) {
  final double halfWidth = rect.width / 2.0;
  final double halfHeight = rect.height / 2.0;
  return Offset(
    rect.left + halfWidth + x * halfWidth,
    rect.top + halfHeight + y * halfHeight,
  );
}