appinioGmbH / flutter_packages

Dart and Flutter plugins/packages used and maintained by @appinioGmbH
187 stars 214 forks source link

[Feature] : Be able to reset the cardsBuilder index to zero #203

Closed tim-armt closed 5 months ago

tim-armt commented 9 months ago

Appinio Swiper

I can't find a method in the package that allows me to reset the cardBuilder index to zero. The index used in the method's callBack never resets to zero, even if the list is dynamically modified.

This means that the entire @Build view has to be rebuilt, but in the context of my MVVM architecture, this poses a problem.

Describe the solution you'd like The solution would be to be able to reset this callBack (index) to zero without having to rebuild the widget. We would need a utility method accessible via the object, controller or other, to reset this index to zero.

Describe alternatives you've considered

  1. I've explored the possibility of using the key parameter with a UniqueKey() but this has undesirable side effects. For information, the desire to reset to zero via a method is to adapt to Navigation (go_router) which avoids rebuilding Widgets systematically and thus having stacks of pages.

    1. I've explored the possibility with notifyListeners that rebuild Widgets, but the problem is that the index persists for the lifetime of the component. The callBack, although rebuilt, will not reset to zero.

Code cardsBuilder: (BuildContext context, int index)

giacomomasseron commented 8 months ago

Hi,
some news about this? I have the same problem. Thanks