Merge pull request #6242 from fufesou/refact/remote_toolbar_border

refact, remote toolbar, border
This commit is contained in:
RustDesk 2023-10-31 17:09:21 +08:00 committed by GitHub
commit fa39982a8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -125,12 +125,13 @@ class _ToolbarTheme {
: EdgeInsets.fromLTRB(6, 14, 6, 14); : EdgeInsets.fromLTRB(6, 14, 6, 14);
static const double menuButtonBorderRadius = 3.0; static const double menuButtonBorderRadius = 3.0;
static get borderColor =>
MyTheme.currentThemeMode() == ThemeMode.light ? bordLight : bordDark;
static final defaultMenuStyle = MenuStyle( static final defaultMenuStyle = MenuStyle(
side: MaterialStateProperty.all(BorderSide( side: MaterialStateProperty.all(BorderSide(
width: 1, width: 1,
color: MyTheme.currentThemeMode() == ThemeMode.light color: borderColor,
? _ToolbarTheme.bordLight
: _ToolbarTheme.bordDark,
)), )),
shape: MaterialStatePropertyAll(RoundedRectangleBorder( shape: MaterialStatePropertyAll(RoundedRectangleBorder(
borderRadius: BorderRadius.circular(_ToolbarTheme.menuBorderRadius))), borderRadius: BorderRadius.circular(_ToolbarTheme.menuBorderRadius))),
@ -141,6 +142,18 @@ class _ToolbarTheme {
padding: MaterialStatePropertyAll(EdgeInsets.zero), padding: MaterialStatePropertyAll(EdgeInsets.zero),
overlayColor: MaterialStatePropertyAll(Colors.transparent), 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(); typedef DismissFunc = void Function();
@ -427,14 +440,14 @@ class _RemoteToolbarState extends State<RemoteToolbar> {
child: Material( child: Material(
elevation: _ToolbarTheme.elevation, elevation: _ToolbarTheme.elevation,
shadowColor: MyTheme.color(context).shadow, shadowColor: MyTheme.color(context).shadow,
child: _DraggableShowHide( child: _ToolbarTheme.borderWrapper(_DraggableShowHide(
sessionId: widget.ffi.sessionId, sessionId: widget.ffi.sessionId,
dragging: _dragging, dragging: _dragging,
fractionX: _fractionX, fractionX: _fractionX,
show: show, show: show,
setFullscreen: _setFullscreen, setFullscreen: _setFullscreen,
setMinimize: _minimize, setMinimize: _minimize,
), )),
), ),
), ),
); );
@ -491,13 +504,13 @@ class _RemoteToolbarState extends State<RemoteToolbar> {
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
child: Theme( child: Theme(
data: themeData(), data: themeData(),
child: Row( child: _ToolbarTheme.borderWrapper(Row(
children: [ children: [
SizedBox(width: _ToolbarTheme.buttonHMargin * 2), SizedBox(width: _ToolbarTheme.buttonHMargin * 2),
...toolbarItems, ...toolbarItems,
SizedBox(width: _ToolbarTheme.buttonHMargin * 2) SizedBox(width: _ToolbarTheme.buttonHMargin * 2)
], ],
), )),
), ),
), ),
), ),