From 4ba2a7fc0757b0383eb3736803b416a0f9c10a03 Mon Sep 17 00:00:00 2001 From: Gold872 Date: Mon, 30 Oct 2023 20:05:32 -0400 Subject: [PATCH] Dynamically determine minimum window size --- lib/main.dart | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/main.dart b/lib/main.dart index 22b2b4fd..fd38b189 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,7 +1,10 @@ +import 'dart:ui'; + import 'package:elastic_dashboard/pages/dashboard_page.dart'; import 'package:elastic_dashboard/services/field_images.dart'; import 'package:elastic_dashboard/services/globals.dart'; import 'package:elastic_dashboard/services/nt4_connection.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:package_info_plus/package_info_plus.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -37,7 +40,10 @@ void main() async { await FieldImages.loadFields('assets/fields/'); - await windowManager.setMinimumSize(const Size(1280, 720)); + FlutterView screenView = PlatformDispatcher.instance.views.first; + Size screenSize = screenView.physicalSize * screenView.devicePixelRatio; + + await windowManager.setMinimumSize(screenSize * 0.55); await windowManager.setTitleBarStyle(TitleBarStyle.hidden, windowButtonVisibility: false);