mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-11-23 19:49:05 +08:00
refact: remote toolbar style (#9597)
Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
parent
507de628c9
commit
e6d4067f48
@ -2336,15 +2336,33 @@ class _DraggableShowHideState extends State<_DraggableShowHide> {
|
||||
);
|
||||
final isFullscreen = stateGlobal.fullscreen;
|
||||
const double iconSize = 20;
|
||||
|
||||
buttonWrapper(VoidCallback? onPressed, Widget child,
|
||||
{Color hoverColor = _ToolbarTheme.blueColor}) {
|
||||
final bgColor = buttonStyle.backgroundColor?.resolve({});
|
||||
return TextButton(
|
||||
onPressed: onPressed,
|
||||
child: child,
|
||||
style: buttonStyle.copyWith(
|
||||
backgroundColor: MaterialStateProperty.resolveWith((states) {
|
||||
if (states.contains(MaterialState.hovered)) {
|
||||
return (bgColor ?? hoverColor).withOpacity(0.15);
|
||||
}
|
||||
return bgColor;
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
final child = Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
_buildDraggable(context),
|
||||
Obx(() => TextButton(
|
||||
onPressed: () {
|
||||
Obx(() => buttonWrapper(
|
||||
() {
|
||||
widget.setFullscreen(!isFullscreen.value);
|
||||
},
|
||||
child: Tooltip(
|
||||
Tooltip(
|
||||
message: translate(
|
||||
isFullscreen.isTrue ? 'Exit Fullscreen' : 'Fullscreen'),
|
||||
child: Icon(
|
||||
@ -2358,9 +2376,9 @@ class _DraggableShowHideState extends State<_DraggableShowHide> {
|
||||
if (!isMacOS && !isWebDesktop)
|
||||
Obx(() => Offstage(
|
||||
offstage: isFullscreen.isFalse,
|
||||
child: TextButton(
|
||||
onPressed: () => widget.setMinimize(),
|
||||
child: Tooltip(
|
||||
child: buttonWrapper(
|
||||
widget.setMinimize,
|
||||
Tooltip(
|
||||
message: translate('Minimize'),
|
||||
child: Icon(
|
||||
Icons.remove,
|
||||
@ -2369,11 +2387,11 @@ class _DraggableShowHideState extends State<_DraggableShowHide> {
|
||||
),
|
||||
),
|
||||
)),
|
||||
TextButton(
|
||||
onPressed: () => setState(() {
|
||||
buttonWrapper(
|
||||
() => setState(() {
|
||||
widget.toolbarState.switchShow(widget.sessionId);
|
||||
}),
|
||||
child: Obx((() => Tooltip(
|
||||
Obx((() => Tooltip(
|
||||
message:
|
||||
translate(show.isTrue ? 'Hide Toolbar' : 'Show Toolbar'),
|
||||
child: Icon(
|
||||
@ -2387,9 +2405,9 @@ class _DraggableShowHideState extends State<_DraggableShowHide> {
|
||||
if (show.isTrue) {
|
||||
return Offstage();
|
||||
} else {
|
||||
return TextButton(
|
||||
onPressed: () => closeConnection(id: widget.id),
|
||||
child: Tooltip(
|
||||
return buttonWrapper(
|
||||
() => closeConnection(id: widget.id),
|
||||
Tooltip(
|
||||
message: translate('Close'),
|
||||
child: Icon(
|
||||
Icons.close,
|
||||
@ -2397,7 +2415,8 @@ class _DraggableShowHideState extends State<_DraggableShowHide> {
|
||||
color: _ToolbarTheme.redColor,
|
||||
),
|
||||
),
|
||||
);
|
||||
hoverColor: _ToolbarTheme.redColor,
|
||||
).paddingOnly(left: iconSize / 2);
|
||||
}
|
||||
})
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user