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

onSlideChanged & onStoryChanged Functions #20

Closed jtkeyva closed 2 years ago

jtkeyva commented 2 years ago

Is your feature request related to a problem? Please describe. Would be great to be able to call a custom function when a slide starts & when a slide ends. For instance once a video is finished it can trigger an onSlideEnd / videoViewed function to add a view count to the database. Also, would be useful to have a function fire onSlideStart

Describe the solution you'd like Ability to define a custom function once a slide begins and ends.

Describe alternatives you've considered Hack the code or use a pageview base approach which has onPageChanged

Additional context Also makes sense to have onStoryChanged so that when a new story starts you can run a different function.

ertgrulll commented 2 years ago

Hi JT, you can add event listener using controller to achieve desired behaviour. Also you can manipulate flow by setting interceptor. Please take a look at example project.

jtkeyva commented 2 years ago

Thank you! I will have a look at the code and the docs. Perhaps we can add to the readme something like:

Run custom events/functions on slide change and story change

ertgrulll commented 2 years ago

Documentation contains useful information about the controller but it looks like I need to update the documentation as well.

docs