FIX_app header freeze fixes
This commit is contained in:
parent
613c8d3392
commit
bc4d642a7b
@ -108,7 +108,10 @@ class _AppHeaderState extends ConsumerState<AppHeader> {
|
||||
builder: (_) {
|
||||
return Positioned(
|
||||
left: offset.dx,
|
||||
top: offset.dy + size.height + 8,
|
||||
// top: offset.dy + size.height + 8,
|
||||
// Reduced +8 to +2 to create an overlap so the mouse never leaves
|
||||
// a "hoverable" area, which prevents the exit flicker.
|
||||
top: offset.dy + size.height + 2,
|
||||
child: MouseRegion(
|
||||
onExit: (_) => _hidePopup(),
|
||||
child: Material(
|
||||
@ -239,8 +242,12 @@ class _AppHeaderState extends ConsumerState<AppHeader> {
|
||||
}
|
||||
|
||||
void _hidePopup() {
|
||||
_overlayEntry?.remove();
|
||||
_overlayEntry = null;
|
||||
if (_overlayEntry != null) {
|
||||
_overlayEntry?.remove();
|
||||
_overlayEntry = null;
|
||||
// Optional: add a small setState if needed to refresh the UI layer
|
||||
if (mounted) setState(() {});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
@ -607,6 +614,13 @@ class _AppHeaderState extends ConsumerState<AppHeader> {
|
||||
final size = renderBox.size;
|
||||
_showPopup(context, offset, size, popupKey);
|
||||
},
|
||||
onExit: (event) {
|
||||
// We check if the mouse is moving downwards (toward the popup)
|
||||
// If not moving toward popup, hide it.
|
||||
if (event.localPosition.dy < 0 || event.localPosition.dx < 0 || event.localPosition.dx > 100) {
|
||||
_hidePopup();
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
@ -659,7 +673,10 @@ class _AppHeaderState extends ConsumerState<AppHeader> {
|
||||
Widget _buildPopupItem({required String label, required VoidCallback onTap}) {
|
||||
return _HoverableContainer(
|
||||
label: label,
|
||||
onTap: onTap,
|
||||
onTap: () {
|
||||
_hidePopup(); // Force hide before executing the specific onTap logic
|
||||
onTap();
|
||||
},
|
||||
normalColor: Colors.white,
|
||||
hoverColor: const Color(0xFFF5F5F5),
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user