tutorial_coach_mark
tutorial_coach_mark copied to clipboard
I would like to swipe TargetFocus, can I do that?
Hi @Kristina-Isakovich ! Thanks for your question. Could you give me more information? Example? I don't understand very well your suggestion.
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.
![](https://user-images.githubusercontent.com/73427550/189841825-8a8b19e5-ddd0-4fd7-86e5-08d6774e62e7.jpg)
Use this can help https://pub.dev/packages/scroll_to_index/example Just pass function and call it on OnClickTarget when target.identify==something
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 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...
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
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.