From 29b0a7659f15c142006fb0014a1e55099730212d Mon Sep 17 00:00:00 2001 From: fufesou Date: Tue, 31 Oct 2023 16:52:18 +0800 Subject: [PATCH 1/2] refact, remote toolbar, border Signed-off-by: fufesou --- .../lib/desktop/widgets/remote_toolbar.dart | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/flutter/lib/desktop/widgets/remote_toolbar.dart b/flutter/lib/desktop/widgets/remote_toolbar.dart index 6f19b2359..f76480cd3 100644 --- a/flutter/lib/desktop/widgets/remote_toolbar.dart +++ b/flutter/lib/desktop/widgets/remote_toolbar.dart @@ -125,12 +125,13 @@ class _ToolbarTheme { : EdgeInsets.fromLTRB(6, 14, 6, 14); static const double menuButtonBorderRadius = 3.0; + static final borderColor = + MyTheme.currentThemeMode() == ThemeMode.light ? bordLight : bordDark; + static final defaultMenuStyle = MenuStyle( side: MaterialStateProperty.all(BorderSide( width: 1, - color: MyTheme.currentThemeMode() == ThemeMode.light - ? _ToolbarTheme.bordLight - : _ToolbarTheme.bordDark, + color: borderColor, )), shape: MaterialStatePropertyAll(RoundedRectangleBorder( borderRadius: BorderRadius.circular(_ToolbarTheme.menuBorderRadius))), @@ -141,6 +142,18 @@ class _ToolbarTheme { padding: MaterialStatePropertyAll(EdgeInsets.zero), overlayColor: MaterialStatePropertyAll(Colors.transparent), ); + + static Widget borderWrapper(Widget child) { + return Container( + decoration: BoxDecoration( + border: Border.all( + color: borderColor, + width: 1, + ), + ), + child: child, + ); + } } typedef DismissFunc = void Function(); @@ -427,14 +440,14 @@ class _RemoteToolbarState extends State { child: Material( elevation: _ToolbarTheme.elevation, shadowColor: MyTheme.color(context).shadow, - child: _DraggableShowHide( + child: _ToolbarTheme.borderWrapper(_DraggableShowHide( sessionId: widget.ffi.sessionId, dragging: _dragging, fractionX: _fractionX, show: show, setFullscreen: _setFullscreen, setMinimize: _minimize, - ), + )), ), ), ); @@ -491,13 +504,13 @@ class _RemoteToolbarState extends State { scrollDirection: Axis.horizontal, child: Theme( data: themeData(), - child: Row( + child: _ToolbarTheme.borderWrapper(Row( children: [ SizedBox(width: _ToolbarTheme.buttonHMargin * 2), ...toolbarItems, SizedBox(width: _ToolbarTheme.buttonHMargin * 2) ], - ), + )), ), ), ), From 4b52414e031880e2eadb78c53d13c66470b5a623 Mon Sep 17 00:00:00 2001 From: fufesou Date: Tue, 31 Oct 2023 16:58:20 +0800 Subject: [PATCH 2/2] use get instead of static value Signed-off-by: fufesou --- flutter/lib/desktop/widgets/remote_toolbar.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flutter/lib/desktop/widgets/remote_toolbar.dart b/flutter/lib/desktop/widgets/remote_toolbar.dart index f76480cd3..7c8c931c4 100644 --- a/flutter/lib/desktop/widgets/remote_toolbar.dart +++ b/flutter/lib/desktop/widgets/remote_toolbar.dart @@ -125,7 +125,7 @@ class _ToolbarTheme { : EdgeInsets.fromLTRB(6, 14, 6, 14); static const double menuButtonBorderRadius = 3.0; - static final borderColor = + static get borderColor => MyTheme.currentThemeMode() == ThemeMode.light ? bordLight : bordDark; static final defaultMenuStyle = MenuStyle(