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

Can I disable completion just for a period of time ? #26

Closed
andrewwahid opened this issue May 22, 2020 · 7 comments
Closed

Can I disable completion just for a period of time ? #26

andrewwahid opened this issue May 22, 2020 · 7 comments

Comments

@andrewwahid
Copy link

andrewwahid commented May 22, 2020

My feature discovery fires when the user spams a certain button
When he spams that button the feature discovery appears but since he is spamming the button he presses on the feature tap target and the feature disappears.
I want to disable the feature tap target for a small period of time to ensure the user have read the feature discovery

Approach ##1: I set onComplete to return a boolean variable and after 1.5 seconds of the feature firing change the variable's value
Problem: onComplete is called only once so if it was fired first time with return value of false, it won't be fired again no matter what.

Approach ##2: Use AbsorbPointer to absorb all touch events of the Feature overlay
Problem: I don't know why but AbsorbPointer doesn't work with the Feature overlay (my theory is because that the widget is overlayed on top of the MaterialApp and not my current context widget)(placing an AbsorbPointer on top my material app is not an option!)

I am open to any suggestions

Thanks in advance!

@ayalma
Copy link
Owner

ayalma commented May 25, 2020

As far as I understand your problem
onComplate is async function
so you can use feature.delayed functon to solve your problem

@andrewwahid
Copy link
Author

As far as I understand your problem
onComplate is async function
so you can use feature.delayed functon to solve your problem

Using Future.delayed and then returning true will only delay the completion but the completion will still fire the moment the user clicks on tap target.
Simply I want to disable the tap target for a certain duration (so the user wont' be able to fire the OnComplete listener)
I have tried several methods but none work.

@axel-op
Copy link
Contributor

axel-op commented May 27, 2020

Your first suggestion should work. onComplete is not, as you said, called only once, it is called every time the target is tapped* until it returns true.

* (actually it is not called if it has been called just before and hasn't completed yet).

@andrewwahid
Copy link
Author

Please test any feature with this as the onComplete parameter
onComplete: () async{ print("Test"); return false; }
You will observe that "Test" is only printed once no matter how many times you pressed on the tap target.

@axel-op
Copy link
Contributor

axel-op commented May 30, 2020

@andrewwahid You're right, in fact there is a bug in the implementation. I'm working on a fix (#28).

@andrewwahid
Copy link
Author

@andrewwahid You're right, in fact there is a bug in the implementation. I'm working on a fix (#28).

@axel-op any updates on the fix ?

@axel-op
Copy link
Contributor

axel-op commented Jun 26, 2020

@andrewwahid You're right, in fact there is a bug in the implementation. I'm working on a fix (#28).

@axel-op any updates on the fix ?

It has been merged in master and will be published under version 0.12.0.

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

3 participants