DavideBelsole / great_list_view

pub.dev library for flutter
MIT License
39 stars 21 forks source link

_currentList will not updated when the controller is not attached to the view #7

Closed ThunderAnimal closed 2 years ago

ThunderAnimal commented 3 years ago

Problem: When working with lazy loadings widgets and an new state of the list has already triggerd via dispatchNewList, it will still show the old state of the list. Example: Working with the BloC Pattern and a TabBarView. Usually you get the new data of the list over a listener and fire dispatchNewList. But the works only for the current visible tab view. when switching to an other tab, you will still the the old state of the list.

Solution: Update the _currentList even when the controller is not attached to an view, but do not perform any animation.

Version: 0.0.10 File: animaeted_list_dispatcher.dart Method: dispatchNewList LOC: 60

original code: if (!animatedListController.isAttached) return;

bug fix: if(!animatedListController.isAttached){ _oldList = currentList; _currentList = newList; return; }

If you want, I can create also a PR, but didn't found any hints how you wanna work with pr :D Actually I just made the fix locale and it works now nice.

BTW: Thx, for the package. Before I had my own solution with Animation and Reorder but yeah it was not quite so good like yours. Had Problems with smooth scrolling during the drag&drop.

raminsafaei commented 3 years ago

I have the same problem just found this package, ran the example, and it worked as expected, but when I tried to use this in my views the widget was blank without throwing any exceptions. I'm using riverpod to get current list

DavideBelsole commented 3 years ago

Please, migrate to the new version (0.1.0) and let me know if the issue persists.