screenDestinationRect static method
Implementation
static Rect screenDestinationRect(
DeviceInfo device,
Orientation orientation,
) {
final destinationRect = globalDestinationRect(
device,
orientation,
);
final frameSize = device.frameSizeOn(orientation);
final scaleX = destinationRect.width / frameSize.width;
final scaleY = destinationRect.height / frameSize.height;
var screenBounds = device.screenPath.getBounds();
if (orientation == Orientation.landscape) {
screenBounds = Offset(
device.frameSize.height - screenBounds.bottom,
screenBounds.left,
) &
screenBounds.size.flipped;
}
return (destinationRect.topLeft +
Offset(
screenBounds.left * scaleX,
screenBounds.top * scaleY,
)) &
Size(
screenBounds.width * scaleX,
screenBounds.height * scaleY,
);
}