Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making a button to show a tooltip when it's a non-modal closes the modal immediately #25

Closed
stargazing-dino opened this issue Jul 18, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@stargazing-dino
Copy link
Owner

stargazing-dino commented Jul 18, 2021

This is semi expected behavior as the tooltip adds a global listener for taps and will close the tooltip if there's any taps. However, I don't think it should happen the second the tooltip is created.

The tap handler should should ignore all taps until hasEntry is true

Edit

It does wait until it has an entry. It still doesn't handle it correctly

void _handlePointerEvent(PointerEvent event) {
    if (!delegate.hasEntry) return;

    if (event is PointerUpEvent || event is PointerCancelEvent) {
      _hideTooltip();
    } else if (event is PointerDownEvent) {
      _hideTooltip(immediately: true);
    }
  }
@stargazing-dino stargazing-dino added the enhancement New feature or request label Jul 18, 2021
@stargazing-dino
Copy link
Owner Author

This was fixed by adding a slight delay which lets the global tap handler go first

// inside _showTooltip
WidgetsBinding.instance?.addPostFrameCallback((_) async {
        await ensureTooltipVisible();
        completer.complete();
      });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant