Merge pull request #5334 from sahilyeole/master

Improve tooltip consistency
This commit is contained in:
RustDesk 2023-08-11 08:07:49 +08:00 committed by GitHub
commit c749ebff46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 17 deletions

View File

@ -219,6 +219,13 @@ class MyTheme {
),
);
//tooltip
static TooltipThemeData tooltipTheme() {
return TooltipThemeData(
waitDuration: Duration(seconds: 1, milliseconds: 500),
);
}
// Dialogs
static const double dialogPadding = 24;
@ -288,6 +295,7 @@ class MyTheme {
tabBarTheme: const TabBarTheme(
labelColor: Colors.black87,
),
tooltipTheme: tooltipTheme(),
splashColor: isDesktop ? Colors.transparent : null,
highlightColor: isDesktop ? Colors.transparent : null,
splashFactory: isDesktop ? NoSplash.splashFactory : null,
@ -377,6 +385,7 @@ class MyTheme {
scrollbarTheme: ScrollbarThemeData(
thumbColor: MaterialStateProperty.all(Colors.grey[500]),
),
tooltipTheme: tooltipTheme(),
splashColor: isDesktop ? Colors.transparent : null,
highlightColor: isDesktop ? Colors.transparent : null,
splashFactory: isDesktop ? NoSplash.splashFactory : null,

View File

@ -1546,7 +1546,7 @@ class _CloseMenu extends StatelessWidget {
class _IconMenuButton extends StatefulWidget {
final String? assetName;
final Widget? icon;
final String? tooltip;
final String tooltip;
final Color color;
final Color hoverColor;
final VoidCallback? onPressed;
@ -1557,7 +1557,7 @@ class _IconMenuButton extends StatefulWidget {
Key? key,
this.assetName,
this.icon,
this.tooltip,
required this.tooltip,
required this.color,
required this.hoverColor,
required this.onPressed,
@ -1595,14 +1595,17 @@ class _IconMenuButtonState extends State<_IconMenuButton> {
hover = value;
}),
onPressed: widget.onPressed,
child: Material(
type: MaterialType.transparency,
child: Ink(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(_ToolbarTheme.iconRadius),
color: hover ? widget.hoverColor : widget.color,
),
child: icon)),
child: Tooltip(
message: translate(widget.tooltip),
child: Material(
type: MaterialType.transparency,
child: Ink(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(_ToolbarTheme.iconRadius),
color: hover ? widget.hoverColor : widget.color,
),
child: icon)),
)
),
).marginSymmetric(
horizontal: widget.hMargin ?? _ToolbarTheme.buttonHMargin,
@ -1669,15 +1672,18 @@ class _IconSubmenuButtonState extends State<_IconSubmenuButton> {
onHover: (value) => setState(() {
hover = value;
}),
child: Material(
type: MaterialType.transparency,
child: Ink(
decoration: BoxDecoration(
borderRadius:
child: Tooltip(
message: translate(widget.tooltip),
child: Material(
type: MaterialType.transparency,
child: Ink(
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(_ToolbarTheme.iconRadius),
color: hover ? widget.hoverColor : widget.color,
color: hover ? widget.hoverColor : widget.color,
),
child: icon))
),
child: icon)),
menuChildren: widget.menuChildren
.map((e) => _buildPointerTrackWidget(e, widget.ffi))
.toList()));
@ -2003,6 +2009,7 @@ class _MultiMonitorMenu extends StatelessWidget {
Obx(() {
RxInt display = CurrentDisplayState.find(id);
return _IconMenuButton(
tooltip: "",
topLevel: false,
color: i == display.value
? _ToolbarTheme.blueColor