Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

refact: remote toolbar style (#9597)

fufesoue6d4067f489f
diff --git a/flutter/lib/desktop/widgets/remote_toolbar.dart b/flutter/lib/desktop/widgets/remote_toolbar.dart
index d92636301..3d8ca5e13 100644
--- a/flutter/lib/desktop/widgets/remote_toolbar.dart
+++ b/flutter/lib/desktop/widgets/remote_toolbar.dart
@@ -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);
}
})
],