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

How to update story content dynamically #14

Closed strmchsr closed 2 years ago

strmchsr commented 2 years ago

I want to update item count dynamically (by pagination or infinite scrolling)

I did the that in tray view by adding a scrollcontroller, But to update the story view we need some way to update the story item when data updates via pagination,

ertgrulll commented 2 years ago

Hello, AdvStory allows async storyBuilder function to requesting data from server. Runs storyBuilder and keeps result in the memory. To update story content count, storyBuilder function should be updated and previously built stories should be cleared, which is not expected behaviour in many use cases. You need to know total story count before creating story view in current implementation, you can paginate stories in storyBuilder but not contents or trays. I designed AdvStory to use with previosuly fetched tray data, i'm requesting user story when a tray tapped or story swiped. But If you provide some code or better yet a reproducible repository I can try more help.

strmchsr commented 2 years ago

Hi @ertgrulll thanks for the quick response, I did the pagination in tray, following is the PR: PR. Now the problem is:

ertgrulll commented 2 years ago

I will release a new version to fix #15, and try to implement this feature as well. Thanks for your feedback! You can wait for this feature or get your hands a little dirty 🤗

ertgrulll commented 2 years ago

0.2.0 version published, I have made changes to allow storyCount update by changing state. This version should fix your problem, you can paginate stories now. If you see any other problem, please file a new issue.

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

strmchsr commented 2 years ago

Thanks ! It was quick