Merge pull request #5334 from sahilyeole/master
Improve tooltip consistency
This commit is contained in:
commit
c749ebff46
flutter/lib
@ -219,6 +219,13 @@ class MyTheme {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//tooltip
|
||||||
|
static TooltipThemeData tooltipTheme() {
|
||||||
|
return TooltipThemeData(
|
||||||
|
waitDuration: Duration(seconds: 1, milliseconds: 500),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Dialogs
|
// Dialogs
|
||||||
static const double dialogPadding = 24;
|
static const double dialogPadding = 24;
|
||||||
|
|
||||||
@ -288,6 +295,7 @@ class MyTheme {
|
|||||||
tabBarTheme: const TabBarTheme(
|
tabBarTheme: const TabBarTheme(
|
||||||
labelColor: Colors.black87,
|
labelColor: Colors.black87,
|
||||||
),
|
),
|
||||||
|
tooltipTheme: tooltipTheme(),
|
||||||
splashColor: isDesktop ? Colors.transparent : null,
|
splashColor: isDesktop ? Colors.transparent : null,
|
||||||
highlightColor: isDesktop ? Colors.transparent : null,
|
highlightColor: isDesktop ? Colors.transparent : null,
|
||||||
splashFactory: isDesktop ? NoSplash.splashFactory : null,
|
splashFactory: isDesktop ? NoSplash.splashFactory : null,
|
||||||
@ -377,6 +385,7 @@ class MyTheme {
|
|||||||
scrollbarTheme: ScrollbarThemeData(
|
scrollbarTheme: ScrollbarThemeData(
|
||||||
thumbColor: MaterialStateProperty.all(Colors.grey[500]),
|
thumbColor: MaterialStateProperty.all(Colors.grey[500]),
|
||||||
),
|
),
|
||||||
|
tooltipTheme: tooltipTheme(),
|
||||||
splashColor: isDesktop ? Colors.transparent : null,
|
splashColor: isDesktop ? Colors.transparent : null,
|
||||||
highlightColor: isDesktop ? Colors.transparent : null,
|
highlightColor: isDesktop ? Colors.transparent : null,
|
||||||
splashFactory: isDesktop ? NoSplash.splashFactory : null,
|
splashFactory: isDesktop ? NoSplash.splashFactory : null,
|
||||||
|
@ -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,14 +1595,17 @@ class _IconMenuButtonState extends State<_IconMenuButton> {
|
|||||||
hover = value;
|
hover = value;
|
||||||
}),
|
}),
|
||||||
onPressed: widget.onPressed,
|
onPressed: widget.onPressed,
|
||||||
child: Material(
|
child: Tooltip(
|
||||||
type: MaterialType.transparency,
|
message: translate(widget.tooltip),
|
||||||
child: Ink(
|
child: Material(
|
||||||
decoration: BoxDecoration(
|
type: MaterialType.transparency,
|
||||||
borderRadius: BorderRadius.circular(_ToolbarTheme.iconRadius),
|
child: Ink(
|
||||||
color: hover ? widget.hoverColor : widget.color,
|
decoration: BoxDecoration(
|
||||||
),
|
borderRadius: BorderRadius.circular(_ToolbarTheme.iconRadius),
|
||||||
child: icon)),
|
color: hover ? widget.hoverColor : widget.color,
|
||||||
|
),
|
||||||
|
child: icon)),
|
||||||
|
)
|
||||||
),
|
),
|
||||||
).marginSymmetric(
|
).marginSymmetric(
|
||||||
horizontal: widget.hMargin ?? _ToolbarTheme.buttonHMargin,
|
horizontal: widget.hMargin ?? _ToolbarTheme.buttonHMargin,
|
||||||
@ -1669,15 +1672,18 @@ class _IconSubmenuButtonState extends State<_IconSubmenuButton> {
|
|||||||
onHover: (value) => setState(() {
|
onHover: (value) => setState(() {
|
||||||
hover = value;
|
hover = value;
|
||||||
}),
|
}),
|
||||||
child: Material(
|
child: Tooltip(
|
||||||
type: MaterialType.transparency,
|
message: translate(widget.tooltip),
|
||||||
child: Ink(
|
child: Material(
|
||||||
decoration: BoxDecoration(
|
type: MaterialType.transparency,
|
||||||
borderRadius:
|
child: Ink(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius:
|
||||||
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: "",
|
||||||
topLevel: false,
|
topLevel: false,
|
||||||
color: i == display.value
|
color: i == display.value
|
||||||
? _ToolbarTheme.blueColor
|
? _ToolbarTheme.blueColor
|
||||||
|
Loading…
x
Reference in New Issue
Block a user