advstory
advstory copied to clipboard
Tweaking to behave a little more like an image gallery
Firstly, thanks for what looks to be an awesome package. It looks really well designed and implemented.
This is probably more of a question than a feature request... my application is more of an "image gallery" than a "story viewer", but your implementation looks super flexible and has a lot of the features I think I am likely to need (eg. playing videos and showing cached images and swiping between them).
I've done a very quick POC using AdvStory.player()
and it was pretty simple to get me about80% of the way there.
A few challenges I see in re-purposing advstory as a more general-purpose image gallery are:
- Hiding the progress indicators. Not sure if there's a good way to hide them totally... setting
valueColor
andbackgroundColor
to transparent seems to work but not sure if there's a better way - Stopping the timed advancement to the next
StoryContent
. I saw another issue talking about this... and possibly using the interceptor to reset it. I wonder whether I'm just going to be constantly "fighting" advstory by doing this though. - I'd like my users to be able to double-tap/pinch to zoom. Again, I saw another issue where I could possibly add a gesture detector. Just wondering whether using an interceptor might be a better way to do it.
I'm happy to fork and add my own custom logic, but I'd prefer to use the built-in features if I can. However, if you think that trying to use advstory in this way is a terrible idea, I'd also be keen to know that before I get too far down the investigation path.
@edwardaux Hey did you end up forking or doing anything? Project seems to be abandoned unfortunately
Nah, I tried a bunch of other packages that all had their own pros/cons. I ended up going with a forked version of https://pub.dev/packages/interactiveviewer_gallery ... that package mostly does what I need and I just tweaked a few little things to make it work how I need it to.
Oh cool that's one package I have not seen. Does it handle preloading and caching? Unlimited content?
What did you end up tweaking?
Thanks
It has been a while since I looked into it... I'm pretty sure it doesn't deal with caching because it just takes a builder that returns a widget - which is kind of nice, because it means I can sometimes embed an image and sometimes a video.
I'm using cached_network_image
in combination with flutter_cache_manager
under the covers to manage my own caching. I haven't bothered doing any preloading yet... I just rely on it being in the cache or the user sees a spinner while I go fetch it.
TBH, I can't really remember exactly what I tweaked. From memory, I found a gist somewhere where someone had done some tweaks to cater for the situation where double-tapping zooms, but then when you pan left/right, when you get to the "edge", it should then scroll into the next item. From memory(?), this package doesn't do that quite right.
What I should have done is fork it and then applied the gist that I found... but I was in a rush, so I ended up just copying the code from the gist. So, now I'm in the position where I can't find the original gist and don't have a local copy of the original package to compare it to.
Got it thanks for explaining :)