From c802b1e95dbbe4f329969c1a9d03cad296ed7853 Mon Sep 17 00:00:00 2001 From: fufesou Date: Wed, 16 Nov 2022 19:49:52 +0800 Subject: [PATCH] fix window border width whenn fullscreen Signed-off-by: fufesou --- flutter/lib/desktop/pages/remote_tab_page.dart | 14 +++++++++----- flutter/lib/models/model.dart | 2 +- flutter/lib/models/state_model.dart | 4 +++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/flutter/lib/desktop/pages/remote_tab_page.dart b/flutter/lib/desktop/pages/remote_tab_page.dart index 5e49895f4..f6ebc0f86 100644 --- a/flutter/lib/desktop/pages/remote_tab_page.dart +++ b/flutter/lib/desktop/pages/remote_tab_page.dart @@ -116,12 +116,14 @@ class _ConnectionTabPageState extends State { @override Widget build(BuildContext context) { - final tabWidget = Container( - decoration: BoxDecoration( + final tabWidget = Obx( + () => Container( + decoration: BoxDecoration( border: Border.all( color: MyTheme.color(context).border!, - width: kWindowBorderWidth)), - child: Scaffold( + width: stateGlobal.windowBorderWidth.value), + ), + child: Scaffold( backgroundColor: Theme.of(context).backgroundColor, body: DesktopTab( controller: tabController, @@ -182,7 +184,9 @@ class _ConnectionTabPageState extends State { ); } }), - )), + ), + ), + ), ); return Platform.isMacOS ? tabWidget diff --git a/flutter/lib/models/model.dart b/flutter/lib/models/model.dart index a074bf266..eca94d5e5 100644 --- a/flutter/lib/models/model.dart +++ b/flutter/lib/models/model.dart @@ -593,7 +593,7 @@ class CanvasModel with ChangeNotifier { return parent.target?.ffiModel.display.height ?? defaultHeight; } - double get windowBorderWidth => stateGlobal.windowBorderWidth; + double get windowBorderWidth => stateGlobal.windowBorderWidth.value; double get tabBarHeight => stateGlobal.tabBarHeight; Size get size { diff --git a/flutter/lib/models/state_model.dart b/flutter/lib/models/state_model.dart index dab21fcb6..1ceee2fe0 100644 --- a/flutter/lib/models/state_model.dart +++ b/flutter/lib/models/state_model.dart @@ -8,14 +8,15 @@ class StateGlobal { bool _fullscreen = false; final RxBool _showTabBar = true.obs; final RxDouble _resizeEdgeSize = 8.0.obs; + final RxDouble _windowBorderWidth = RxDouble(kWindowBorderWidth); final RxBool showRemoteMenuBar = false.obs; int get windowId => _windowId; bool get fullscreen => _fullscreen; double get tabBarHeight => fullscreen ? 0 : kDesktopRemoteTabBarHeight; - double get windowBorderWidth => fullscreen ? 0 : kWindowBorderWidth; RxBool get showTabBar => _showTabBar; RxDouble get resizeEdgeSize => _resizeEdgeSize; + RxDouble get windowBorderWidth => _windowBorderWidth; setWindowId(int id) => _windowId = id; setFullscreen(bool v) { @@ -24,6 +25,7 @@ class StateGlobal { _showTabBar.value = !_fullscreen; _resizeEdgeSize.value = fullscreen ? kFullScreenEdgeSize : kWindowEdgeSize; + _windowBorderWidth.value = fullscreen ? 0 : kWindowBorderWidth; WindowController.fromWindowId(windowId).setFullscreen(_fullscreen); } }