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