fix: disappearing hover effect on popover trigger (#1403)

This commit is contained in:
Eakam
2022-11-01 09:01:35 -04:00
committed by GitHub
parent 9c8d00bb61
commit cd8e4ddf00
2 changed files with 4 additions and 12 deletions

View File

@ -96,7 +96,6 @@ class Popover extends StatefulWidget {
class PopoverState extends State<Popover> { class PopoverState extends State<Popover> {
static final RootOverlayEntry _rootEntry = RootOverlayEntry(); static final RootOverlayEntry _rootEntry = RootOverlayEntry();
final PopoverLink popoverLink = PopoverLink(); final PopoverLink popoverLink = PopoverLink();
Timer? _debounceEnterRegionAction;
@override @override
void initState() { void initState() {
@ -175,16 +174,9 @@ class PopoverState extends State<Popover> {
return MouseRegion( return MouseRegion(
onEnter: (event) { onEnter: (event) {
_debounceEnterRegionAction =
Timer(const Duration(milliseconds: 200), () {
if (widget.triggerActions & PopoverTriggerFlags.hover != 0) { if (widget.triggerActions & PopoverTriggerFlags.hover != 0) {
showOverlay(); showOverlay();
} }
});
},
onExit: (event) {
_debounceEnterRegionAction?.cancel();
_debounceEnterRegionAction = null;
}, },
child: Listener( child: Listener(
child: widget.child, child: widget.child,

View File

@ -51,7 +51,7 @@ class _FlowyHoverState extends State<FlowyHover> {
return MouseRegion( return MouseRegion(
cursor: widget.cursor != null ? widget.cursor! : SystemMouseCursors.click, cursor: widget.cursor != null ? widget.cursor! : SystemMouseCursors.click,
opaque: false, opaque: false,
onEnter: (p) { onHover: (p) {
if (_onHover) return; if (_onHover) return;
if (widget.buildWhenOnHover?.call() ?? true) { if (widget.buildWhenOnHover?.call() ?? true) {