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

Avoid/block target tab for 2 seconds, after previous target tab #134

Closed
adschi opened this issue Nov 19, 2022 · 6 comments
Closed

Avoid/block target tab for 2 seconds, after previous target tab #134

adschi opened this issue Nov 19, 2022 · 6 comments

Comments

@adschi
Copy link

adschi commented Nov 19, 2022

Hey there, love the package and trying to implement a cool tutorial with it.. But here is my problem:

When user presses quickly and many times on targets, it likely to crash the animation between animating.. How can I block the user's gesture for like 2 seconds after he presses the first target? After 2secs enable the press again and so on..
When I create the TutorialCoachMark with the targets, the enableTargetTab Option in the TargetFocus won´t update anymore..

Thank you very much. :)

@RafaelBarbosatec
Copy link
Owner

Hi @adschi ! Thanks so much!
I’m sorry, i don’t can reproduce this problem.

@sevenzees
Copy link

I'm also experiencing this problem in my app. I don't see the problem when running the example code though.

@sevenzees
Copy link

In my app, if the user taps a bunch of times (specifically if they tap while the tutorial is between the unfocus animation and the next focus animation), the best case scenario is that the tutorial exits. The worst case is that sometimes it corrupts the state and I need to restart the app.

@sevenzees
Copy link

It would be very useful to be able to block taps during the animation between tutorial steps. @adschi, did you ever figure out how to do this?

@adschi
Copy link
Author

adschi commented Nov 9, 2023

@sevenzees Yes, i fixed it with an extra IgnorePointer Widget Overlay, which i set to ignore pointer for 2 seconds after every next step click.

@sevenzees
Copy link

sevenzees commented Nov 10, 2023

@adschi Thanks for pointing me in the right direction. For anyone else with the same issue, here's the code I used to "fix" it. I just called this every next step click:

static void showOverlay(BuildContext context) {
    OverlayState overlayState = Overlay.of(context);

    OverlayEntry overlayEntry = OverlayEntry(
      builder: (context) {
        return Positioned.fill(
          child: Listener(
            behavior: HitTestBehavior.opaque,
            child: Container(),
          ),
        );
      },
    );

    if (kDebugMode) {
      print('Applying no-tap overlay');
    }

    overlayState.insert(overlayEntry);
    Future.delayed(const Duration(seconds: 2))
        .whenComplete(() => overlayEntry.remove());
  }

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