FIX_app header freeze fixes
This commit is contained in:
parent
613c8d3392
commit
bc4d642a7b
@ -108,7 +108,10 @@ class _AppHeaderState extends ConsumerState<AppHeader> {
|
|||||||
builder: (_) {
|
builder: (_) {
|
||||||
return Positioned(
|
return Positioned(
|
||||||
left: offset.dx,
|
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(
|
child: MouseRegion(
|
||||||
onExit: (_) => _hidePopup(),
|
onExit: (_) => _hidePopup(),
|
||||||
child: Material(
|
child: Material(
|
||||||
@ -239,8 +242,12 @@ class _AppHeaderState extends ConsumerState<AppHeader> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _hidePopup() {
|
void _hidePopup() {
|
||||||
|
if (_overlayEntry != null) {
|
||||||
_overlayEntry?.remove();
|
_overlayEntry?.remove();
|
||||||
_overlayEntry = null;
|
_overlayEntry = null;
|
||||||
|
// Optional: add a small setState if needed to refresh the UI layer
|
||||||
|
if (mounted) setState(() {});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -607,6 +614,13 @@ class _AppHeaderState extends ConsumerState<AppHeader> {
|
|||||||
final size = renderBox.size;
|
final size = renderBox.size;
|
||||||
_showPopup(context, offset, size, popupKey);
|
_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(
|
child: Container(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -659,7 +673,10 @@ class _AppHeaderState extends ConsumerState<AppHeader> {
|
|||||||
Widget _buildPopupItem({required String label, required VoidCallback onTap}) {
|
Widget _buildPopupItem({required String label, required VoidCallback onTap}) {
|
||||||
return _HoverableContainer(
|
return _HoverableContainer(
|
||||||
label: label,
|
label: label,
|
||||||
onTap: onTap,
|
onTap: () {
|
||||||
|
_hidePopup(); // Force hide before executing the specific onTap logic
|
||||||
|
onTap();
|
||||||
|
},
|
||||||
normalColor: Colors.white,
|
normalColor: Colors.white,
|
||||||
hoverColor: const Color(0xFFF5F5F5),
|
hoverColor: const Color(0xFFF5F5F5),
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user