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;
|
final isFullscreen = stateGlobal.fullscreen;
|
||||||
const double iconSize = 20;
|
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(
|
final child = Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
_buildDraggable(context),
|
_buildDraggable(context),
|
||||||
Obx(() => TextButton(
|
Obx(() => buttonWrapper(
|
||||||
onPressed: () {
|
() {
|
||||||
widget.setFullscreen(!isFullscreen.value);
|
widget.setFullscreen(!isFullscreen.value);
|
||||||
},
|
},
|
||||||
child: Tooltip(
|
Tooltip(
|
||||||
message: translate(
|
message: translate(
|
||||||
isFullscreen.isTrue ? 'Exit Fullscreen' : 'Fullscreen'),
|
isFullscreen.isTrue ? 'Exit Fullscreen' : 'Fullscreen'),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
@ -2358,9 +2376,9 @@ class _DraggableShowHideState extends State<_DraggableShowHide> {
|
|||||||
if (!isMacOS && !isWebDesktop)
|
if (!isMacOS && !isWebDesktop)
|
||||||
Obx(() => Offstage(
|
Obx(() => Offstage(
|
||||||
offstage: isFullscreen.isFalse,
|
offstage: isFullscreen.isFalse,
|
||||||
child: TextButton(
|
child: buttonWrapper(
|
||||||
onPressed: () => widget.setMinimize(),
|
widget.setMinimize,
|
||||||
child: Tooltip(
|
Tooltip(
|
||||||
message: translate('Minimize'),
|
message: translate('Minimize'),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.remove,
|
Icons.remove,
|
||||||
@ -2369,11 +2387,11 @@ class _DraggableShowHideState extends State<_DraggableShowHide> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
TextButton(
|
buttonWrapper(
|
||||||
onPressed: () => setState(() {
|
() => setState(() {
|
||||||
widget.toolbarState.switchShow(widget.sessionId);
|
widget.toolbarState.switchShow(widget.sessionId);
|
||||||
}),
|
}),
|
||||||
child: Obx((() => Tooltip(
|
Obx((() => Tooltip(
|
||||||
message:
|
message:
|
||||||
translate(show.isTrue ? 'Hide Toolbar' : 'Show Toolbar'),
|
translate(show.isTrue ? 'Hide Toolbar' : 'Show Toolbar'),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
@ -2387,9 +2405,9 @@ class _DraggableShowHideState extends State<_DraggableShowHide> {
|
|||||||
if (show.isTrue) {
|
if (show.isTrue) {
|
||||||
return Offstage();
|
return Offstage();
|
||||||
} else {
|
} else {
|
||||||
return TextButton(
|
return buttonWrapper(
|
||||||
onPressed: () => closeConnection(id: widget.id),
|
() => closeConnection(id: widget.id),
|
||||||
child: Tooltip(
|
Tooltip(
|
||||||
message: translate('Close'),
|
message: translate('Close'),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.close,
|
Icons.close,
|
||||||
@ -2397,7 +2415,8 @@ class _DraggableShowHideState extends State<_DraggableShowHide> {
|
|||||||
color: _ToolbarTheme.redColor,
|
color: _ToolbarTheme.redColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
hoverColor: _ToolbarTheme.redColor,
|
||||||
|
).paddingOnly(left: iconSize / 2);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user