WidgetCoordinates.fromRect constructor
WidgetCoordinates.fromRect(
- Rect rect
Converts a rect in logical pixels to the physical-pixel coordinates the native side expects. Edges are rounded outwards so no edge pixel of the widget is left uncovered.
Implementation
factory WidgetCoordinates.fromRect(Rect rect) {
final double scale = _physicalPixelScale();
return WidgetCoordinates(
(rect.left * scale).floor(),
(rect.top * scale).floor(),
(rect.right * scale).ceil(),
(rect.bottom * scale).ceil(),
);
}