enable tooltip for menu buttons

Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>
This commit is contained in:
Sahil Yeole 2023-08-10 18:31:24 +05:30
parent a1095b8844
commit f502eb0ea5

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: "Multi monitor",
topLevel: false,
color: i == display.value
? _ToolbarTheme.blueColor