From f502eb0ea5d6eb521e069fe3853ed74b277dec57 Mon Sep 17 00:00:00 2001 From: Sahil Yeole Date: Thu, 10 Aug 2023 18:31:24 +0530 Subject: [PATCH 1/3] enable tooltip for menu buttons Signed-off-by: Sahil Yeole --- .../lib/desktop/widgets/remote_toolbar.dart | 41 +++++++++++-------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/flutter/lib/desktop/widgets/remote_toolbar.dart b/flutter/lib/desktop/widgets/remote_toolbar.dart index dcf78b27b..5c04d5e8e 100644 --- a/flutter/lib/desktop/widgets/remote_toolbar.dart +++ b/flutter/lib/desktop/widgets/remote_toolbar.dart @@ -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: "Multi monitor", topLevel: false, color: i == display.value ? _ToolbarTheme.blueColor From 66b90c2a08e437eb5517654ba7e6969361b57ddc Mon Sep 17 00:00:00 2001 From: Sahil Yeole Date: Thu, 10 Aug 2023 18:32:02 +0530 Subject: [PATCH 2/3] add global tooltip wait duration Signed-off-by: Sahil Yeole --- flutter/lib/common.dart | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart index 799894f7e..91e514a76 100644 --- a/flutter/lib/common.dart +++ b/flutter/lib/common.dart @@ -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, From 823632ccbaf6d481f231b378f7ae461347d062c4 Mon Sep 17 00:00:00 2001 From: Sahil Yeole Date: Thu, 10 Aug 2023 20:09:43 +0530 Subject: [PATCH 3/3] remove multi monitor tooltip Signed-off-by: Sahil Yeole --- flutter/lib/desktop/widgets/remote_toolbar.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flutter/lib/desktop/widgets/remote_toolbar.dart b/flutter/lib/desktop/widgets/remote_toolbar.dart index 5c04d5e8e..b15c9d540 100644 --- a/flutter/lib/desktop/widgets/remote_toolbar.dart +++ b/flutter/lib/desktop/widgets/remote_toolbar.dart @@ -2009,7 +2009,7 @@ class _MultiMonitorMenu extends StatelessWidget { Obx(() { RxInt display = CurrentDisplayState.find(id); return _IconMenuButton( - tooltip: "Multi monitor", + tooltip: "", topLevel: false, color: i == display.value ? _ToolbarTheme.blueColor