tutorial_coach_mark icon indicating copy to clipboard operation
tutorial_coach_mark copied to clipboard

I would like to swipe TargetFocus, can I do that?

Open Kristina-Isakovich opened this issue 1 year ago • 7 comments

Kristina-Isakovich avatar Sep 12 '22 15:09 Kristina-Isakovich

Hi @Kristina-Isakovich ! Thanks for your question. Could you give me more information? Example? I don't understand very well your suggestion.

RafaelBarbosatec avatar Sep 12 '22 21:09 RafaelBarbosatec

Hi! I have a widget that can be swiped, and I would like the user to be able to interact with it during the tutorial.

Kristina-Isakovich avatar Sep 13 '22 07:09 Kristina-Isakovich

Use this can help https://pub.dev/packages/scroll_to_index/example Just pass function and call it on OnClickTarget when target.identify==something

SpaceXM avatar Dec 28 '22 15:12 SpaceXM

I was looking a solution, scroll_to_index package was not good solution for me. I used this function. And it is pretty good for my use case.

Scrollable.ensureVisible(globalKeyToSwipe.currentContext!,
                  duration: const Duration(milliseconds: 500), curve: Curves.easeInOut);

cakkiraz avatar Feb 26 '24 14:02 cakkiraz

@cakkiraz Would you have an example of how to use your approach? I'm not sure of how to bind this with the TutorialCoachMark or the TargetFocus...

I'm using a scrollable PageView...

yakou32 avatar May 03 '24 07:05 yakou32

Sure @yakou32,

Let's say i have a widget that has postsKey key. And when the time comes before showing that step in the tutorial, i want to scroll to that widget to make it visible. (One before step was for widget that has storiesKey key. After clicking that stories widget the next tutorial step will be posts step.)

onClickTarget: (target) async { if (target.keyTarget == storiesKey) { await Future.delayed(const Duration(milliseconds: 400)); Scrollable.ensureVisible(postsKey.currentContext!, duration: const Duration(milliseconds: 500), curve: Curves.easeInOut); } },

I added a delay before ensureVisible, I cannot remember the reason of that. It may work without it too.

If you need more clarification i can answer it

cakkiraz avatar May 03 '24 07:05 cakkiraz

Oh thanks!

In fact, I was wondering how to make the user swipe the target instead of click on it in order to proceed to the next target.

But I may use your approach instead to animate the initial target as if it was swiped by the user.

yakou32 avatar May 03 '24 13:05 yakou32