fix tooltip stacking on fast mouse movement

The delayed show callback fired even after the mouse had already
exited, causing tooltips to stack. Track hover state with a bool
and check it after the delay before showing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-22 23:19:32 +02:00
co-authored by Claude Opus 4.6
parent 8a94fd07a7
commit 257bb0cd94
+7 -2
View File
@@ -22,6 +22,7 @@ class ClideTooltip extends StatefulWidget {
class _ClideTooltipState extends State<ClideTooltip> {
OverlayEntry? _entry;
bool _hovering = false;
void _show() {
final overlay = Overlay.maybeOf(context);
@@ -68,10 +69,14 @@ class _ClideTooltipState extends State<ClideTooltip> {
tooltip: widget.message,
child: MouseRegion(
onEnter: (_) async {
_hovering = true;
await Future<void>.delayed(widget.showDelay);
if (mounted) _show();
if (mounted && _hovering) _show();
},
onExit: (_) {
_hovering = false;
_hide();
},
onExit: (_) => _hide(),
child: widget.child,
),
);