better restore window size

Signed-off-by: dignow <linlong1265@gmail.com>
This commit is contained in:
dignow 2023-08-03 18:15:50 +08:00
parent bdc5cded22
commit f64dd3794a

View File

@ -1419,24 +1419,10 @@ Future<void> saveWindowPosition(WindowType type, {int? windowId}) async {
} }
Future<Size> _adjustRestoreMainWindowSize(double? width, double? height) async { Future<Size> _adjustRestoreMainWindowSize(double? width, double? height) async {
const double minWidth = 600; const double minWidth = 1;
const double minHeight = 100; const double minHeight = 1;
double maxWidth = (((isDesktop || isWebDesktop) const double maxWidth = 6480;
? kDesktopMaxDisplaySize const double maxHeight = 6480;
: kMobileMaxDisplaySize))
.toDouble();
double maxHeight = ((isDesktop || isWebDesktop)
? kDesktopMaxDisplaySize
: kMobileMaxDisplaySize)
.toDouble();
if (isDesktop || isWebDesktop) {
final screen = (await window_size.getWindowInfo()).screen;
if (screen != null) {
maxWidth = screen.visibleFrame.width;
maxHeight = screen.visibleFrame.height;
}
}
final defaultWidth = final defaultWidth =
((isDesktop || isWebDesktop) ? 1280 : kMobileDefaultDisplayWidth) ((isDesktop || isWebDesktop) ? 1280 : kMobileDefaultDisplayWidth)