From ff254188a0943ab9be90e0ca07afacf590ea542c Mon Sep 17 00:00:00 2001 From: Andrei Toterman Date: Thu, 12 Dec 2024 11:21:48 +0100 Subject: [PATCH] [gui] take screen aspect ratio into consideration --- src/client/gui/lib/main.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/client/gui/lib/main.dart b/src/client/gui/lib/main.dart index 14b4b84725..a60905190e 100644 --- a/src/client/gui/lib/main.dart +++ b/src/client/gui/lib/main.dart @@ -266,6 +266,7 @@ Size deriveWindowSize(SharedPreferences sharedPreferences, Size? screenSize) { Size computeDefaultWindowSize(Size? screenSize) { const windowSizeFactor = 0.8; final (screenWidth, screenHeight) = (screenSize?.width, screenSize?.height); + final aspectRatioFactor = screenSize?.flipped.aspectRatio; final defaultWidth = switch (screenWidth) { null || <= 1024 => 750.0, @@ -276,7 +277,9 @@ Size computeDefaultWindowSize(Size? screenSize) { final defaultHeight = switch (screenHeight) { null || <= 576 => 450.0, >= 900 => 822.0, - _ => defaultWidth * 9 / 16, + _ => aspectRatioFactor != null + ? defaultWidth * aspectRatioFactor + : screenHeight * windowSizeFactor, }; final size = Size(defaultWidth, defaultHeight);