From 8ec565d5a071ecb933ecb8edb0ca0a99a9c236a1 Mon Sep 17 00:00:00 2001 From: fufesou Date: Mon, 10 Oct 2022 09:56:27 +0800 Subject: [PATCH] flutter_desktop: adjust window, debug done Signed-off-by: fufesou --- flutter/lib/common.dart | 34 +++++++++++-------- .../lib/desktop/widgets/remote_menubar.dart | 4 +-- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart index d68467d91..8b8403954 100644 --- a/flutter/lib/common.dart +++ b/flutter/lib/common.dart @@ -1029,12 +1029,14 @@ Future saveWindowPosition(WindowType type, {int? windowId}) async { _adjustRestoreMainWindowSize(double? width, double? height) async { const double minWidth = 600; const double minHeight = 100; - double maxWidth = ((isDesktop || isWebDesktop) - ? kDesktopMaxDisplayWidth - : kMobileMaxDisplayWidth) as double; + double maxWidth = (((isDesktop || isWebDesktop) + ? kDesktopMaxDisplayWidth + : kMobileMaxDisplayWidth)) + .toDouble(); double maxHeight = ((isDesktop || isWebDesktop) - ? kDesktopMaxDisplayHeight - : kMobileMaxDisplayHeight) as double; + ? kDesktopMaxDisplayHeight + : kMobileMaxDisplayHeight) + .toDouble(); if (isDesktop || isWebDesktop) { final screen = (await window_size.getWindowInfo()).screen; @@ -1044,12 +1046,12 @@ _adjustRestoreMainWindowSize(double? width, double? height) async { } } - final defaultWidth = ((isDesktop || isWebDesktop) - ? 1280 - : kMobileDefaultDisplayWidth) as double; - final defaultHeight = ((isDesktop || isWebDesktop) - ? 720 - : kMobileDefaultDisplayHeight) as double; + final defaultWidth = + ((isDesktop || isWebDesktop) ? 1280 : kMobileDefaultDisplayWidth) + .toDouble(); + final defaultHeight = + ((isDesktop || isWebDesktop) ? 720 : kMobileDefaultDisplayHeight) + .toDouble(); double restoreWidth = width ?? defaultWidth; double restoreHeight = height ?? defaultHeight; @@ -1078,11 +1080,13 @@ _adjustRestoreMainWindowOffset(double? left, double? top) async { double frameLeft = 0; double frameTop = 0; double frameRight = ((isDesktop || isWebDesktop) - ? kDesktopMaxDisplayWidth - : kMobileMaxDisplayWidth) as double; + ? kDesktopMaxDisplayWidth + : kMobileMaxDisplayWidth) + .toDouble(); double frameBottom = ((isDesktop || isWebDesktop) - ? kDesktopMaxDisplayHeight - : kMobileMaxDisplayHeight) as double; + ? kDesktopMaxDisplayHeight + : kMobileMaxDisplayHeight) + .toDouble(); if (isDesktop || isWebDesktop) { final screen = (await window_size.getWindowInfo()).screen; diff --git a/flutter/lib/desktop/widgets/remote_menubar.dart b/flutter/lib/desktop/widgets/remote_menubar.dart index 529c2657f..13aa1932f 100644 --- a/flutter/lib/desktop/widgets/remote_menubar.dart +++ b/flutter/lib/desktop/widgets/remote_menubar.dart @@ -628,8 +628,7 @@ class _RemoteMenubarState extends State { double scale = _screen!.scaleFactor; double selfWidth = _screen!.frame.width; double selfHeight = _screen!.frame.height; - final RxBool fullscreen = Get.find(tag: 'fullscreen'); - if (fullscreen.isFalse) { + if (isFullscreen) { selfWidth = _screen!.visibleFrame.width; selfHeight = _screen!.visibleFrame.height; } @@ -816,6 +815,7 @@ class _RemoteMenubarState extends State { () async { await _updateScreen(); if (_screen != null) { + _setFullscreen(false); double scale = _screen!.scaleFactor; final wndRect = await WindowController.fromWindowId(widget.windowId)