ertgrulll / advstory

An advanced, complete story viewer for Flutter. Has support for images, videos, custom widget contents, gestures, interceptors, listeners, manipulators and much more.
https://advstory.sourcekod.com
MIT License
41 stars 33 forks source link

AdvStoryController throws exception when jumpTo called on trayTap event #15

Closed eilhcir closed 2 years ago

eilhcir commented 2 years ago

How can I implement seen feature like when I already saw the content It will jump to next content which not yet viewed?

Currently, when the tray open I can't skip or jump it using the controller listener.

ertgrulll commented 2 years ago

I am able to reproduce the issue. When jumpTo is called on the StoryEvent.trayTap, AdvStoryController throws an exception because the story view page controller has not been created yet. I will release a new version to fix the issue as soon as possible. I will provide an example for seen feature as well. Thanks for your feedback!

eilhcir commented 2 years ago

Cool, Thank you for your awesome package.

ertgrulll commented 2 years ago

jumpTo bug fixed in version 0.2.0, but I have added interceptor support to make things better. When you call jumpTo on StoryEvent.trayTap, AdvStory creates tapped story and some of it's content and after that jumps to the given position, but using interceptor you can change opening position before view opened.

I didn't update docs yet, but you can look at interceptor example to see usage. Use setTrayTapInterceptor from controller, AdvStory calls this method when StoryEvent.trayTap happened. Return desired StoryPosition to open view at that position when needed, or return null to allow to continue default flow. At this point, I think I don't need to give an example, but if you have any problems, you can contact me.

Also you can add interceptor to block any other story event, not just for tray tap.

Some minor changes in this version may affect your project, please have a look at the changelog. Happy coding!