getBounds method
The bounds of this tray icon, in logical pixels as before; null where the system does not tell (Linux).
Implementation
Future<Rect?> getBounds() async {
final bounds = _ensureTrayIcon.getBounds();
if (bounds.isEmpty) {
return null;
}
if (!Platform.isWindows) {
return bounds;
}
// Windows reports physical pixels; 0.5.x divided them by the view's ratio.
final views = PlatformDispatcher.instance.views;
final ratio = views.isEmpty ? 1.0 : views.first.devicePixelRatio;
return Rect.fromLTWH(
bounds.left / ratio,
bounds.top / ratio,
bounds.width / ratio,
bounds.height / ratio,
);
}