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

Trigger an action on tap and on dismissed #41

Closed
fictionteamapps opened this issue Nov 1, 2021 · 3 comments
Closed

Trigger an action on tap and on dismissed #41

fictionteamapps opened this issue Nov 1, 2021 · 3 comments

Comments

@fictionteamapps
Copy link

No description provided.

@stargazing-dino
Copy link
Owner

stargazing-dino commented Nov 1, 2021

Hi ! Yeah, you can do that with a controller now.

Here's some code:

@override
void initState() {
  // Programatically display tooltip after two seconds
  Future.delayed(const Duration(seconds: 2), () {
    tooltipController.showTooltip(immediately: false);
  });

  tooltipController.addListener(() {
    // Prints the enum value of [TooltipStatus.isShowing] or [TooltipStatus.isHiding]
    if (tooltipController.value == TooltipStatus.isShowing) {
      // my logic
    }
  });
}

You'll just need to create a controller as you would any other and pass it through the JustTheTooltip constructor.


If you mean it'd be cool to have callbacks on the actual constructor:

JustTheTooltip(
  onClose: () {},
  onOpen: () {}
)

that's another thing and I'd gladly look at a PR

Edit

Make sure you're on version 0.0.10. That's the latest one with better controller state handling

@fictionteamapps
Copy link
Author

JustTheTooltip(
onClose: () {},
onOpen: () {}
)

Yeah, that's what I meant
I hope to be added soon, Thank you

@stargazing-dino
Copy link
Owner

Thank you the suggestion. 0.0.11 now has these callbacks. For any issues with them, please raise a new issue. Thank you !

JustTheTooltip(
  onDismiss: () {
    // do something
  },
  onShow: () {
    // something else
  }
),

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

No branches or pull requests

2 participants