Open JonathanKohlhas opened 7 months ago
I have exactly the same use case. The noticeable delay in my case only is a flicker, albeit an annoying one, because I started to initialize the video outside the AppinioSwiper to improve the performance. But having the behaviour like described by @JonathanKohlhas would make the code cleaner and remove the flicker altogether.
Thanks in advance!
Plugin name Appinio Swiper
Is your feature request related to a problem? Please describe. When Statefull Widgets move from being in the background of the swiper to being in the foreground of the swiper, they are rebuild without preserving their state. Local keys cannot be used because the foreground and background cards don't have the same parent in the widget tree. At the same time Global Keys cannot be used, because of how the background is constructed by repeating the same widget, as this leads to error because of multiple widgets with the same global key.
Describe the solution you'd like The state of the widgets should be preserved and preferably Global Keys would also be usable on card widgets, maybe a background card could be provided to the swiper that is used for every background card after the second one ? this would prevent problems with using global keys.
Additional context In my specific case the reason why recreation of the widget state is a problem is because the cards contain looping videos that restart with a noticable delay when cards move to the foreground a card is swiped away