New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use dismissable widget with HugeListView #7
Comments
That might be a tough question, I never needed modification in the list, just display the fixed items. I would first think about invalidating and reloading the current page but I doubt it will look nice. Do you also need the nice animation? |
The animation is handled by the dismissible widget itself so that is given by default. The tricky part is that the respective item needs to be removed from the underlying list. I already tried to modify the HugeListView widget to allow for that but I got only halfway there yet :) |
The widget has a |
So I managed to implement what I need. In order to do so I needed following features: For that I introduced a simple controller class:
Now in HugeListView I changed following: added a method to invalidate the cache:
Then made use of the new controller class
And set the callbacks in initState:
Now lastly in order to "silently" - so without a reload remove listView items I added the page to the builder callback:
With that I can now do the following when passing a HugeListViewController Just wanted to share my solution here in case you are interested as it is actually just an extension of you implementation without changing any functionalities. |
Ok actually I needed to do one more thing to make this work as now the totalItemCount can change. I enabled setting the totalItemCount on via the controller, and added a property to the state: I initialize the totalItemCount in initState and use a ValueListenableBuilder to do a targeted rebuild on the DraggableScrollbar. This way I can update the _totalItemCount without reloading the whole page.
|
Nice, a controller is always a good solution. Could you wrap it up into a PR? Maybe even adding a few words to the README describing the possibilities. |
Sure thing! Will just clean up the implementation and test it a bit more 👍 |
Would love to use this new feature ! |
Your explanation and code was very clear because I successfully manage to invalidate the cache after filtering my list 🤩 but still would love to see this feature in a PR if you've got the time :) |
First of all - thx for the nice package!
I have following use case:
Similar to you I have a huge list consisting not of a dictionary but names.
What I want to provide to users is the possibility to either like or dislike a name entry. For that I am using a dismissible widget.
Now on swiping the dismissible widget I need to remove the respective entry from the list, however I have not found a solution for that yet (on standard listviews with a builder I would simply remove the respective item from the underlying list and that's it).
I could use a regular Listview.builder approach for that but your package was the only one which allowed for having a draggable scrollbar without completely freezing once I start dragging.
Is there any (easy) solution to achieving this?
The text was updated successfully, but these errors were encountered: