Skip to content

Commit

Permalink
Fixed minimum window size on different DPI displays (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gold872 authored Aug 26, 2024
1 parent 247ea07 commit d338a6e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,12 @@ void main() async {
await FieldImages.loadFields('assets/fields/');

Display primaryDisplay = await screenRetriever.getPrimaryDisplay();
Size screenSize = (primaryDisplay.visibleSize ?? primaryDisplay.size) *
(primaryDisplay.scaleFactor?.toDouble() ?? 1.0);
double scaleFactor = (primaryDisplay.scaleFactor?.toDouble() ?? 1.0);
Size screenSize =
(primaryDisplay.visibleSize ?? primaryDisplay.size) * scaleFactor;

double minimumWidth = min(screenSize.width * 0.60, 1280.0);
double minimumHeight = min(screenSize.height * 0.60, 720.0);
double minimumWidth = min(screenSize.width * 0.77 / scaleFactor, 1280.0);
double minimumHeight = min(screenSize.height * 0.7 / scaleFactor, 720.0);

Size minimumSize = Size(minimumWidth, minimumHeight);

Expand Down

0 comments on commit d338a6e

Please sign in to comment.