huge_listview icon indicating copy to clipboard operation
huge_listview copied to clipboard

How to refresh list?

Open kmarkovych opened this issue 2 years ago • 4 comments

Hello, Many thanks for such a good widget.

Could you please clarify how can I refresh list, for example, with liquid_pull_to_refresh (https://pub.dev/packages/liquid_pull_to_refresh) widget?

kmarkovych avatar Nov 21 '22 17:11 kmarkovych

The original idea that I based upon handled invalidation but, I don't know why, I probably left that out. Maybe I didn't need it and forgot about it...? This doesn't mean we can observe the same scroller behavior as the original ListView (this is mentioned in the README), but you could just call into the list controller if it was implemented.

Looking into the original code, it might be as simple as calling:

map.clear();
setState(() {});

Could you try that and see if it works? Maybe at first not even with the package you mention, just adding a temporary refresh button to your app and calling from there. I'd suggest the usual workaround for the test, adding a reload() into HugeListViewState, passing a unique key to your list and using the key to reach into the state and call the reload. If it works, we can go forward from there.

deakjahn avatar Nov 22 '22 13:11 deakjahn

Unfortunately, I don’t have an access to the map, so I'm unable to do it. I'd like to avoid a copy/paste of the whole class/

kmarkovych avatar Dec 30 '22 09:12 kmarkovych

The suggestion was to modify the source of this plugin. Being open source, you do have access. :-) I would suggest to add a new function with those two lines, somewhere near:

https://github.com/deakjahn/huge_listview/blob/ea305ccfdb3ab082ab2535e5acc85cf09b89b3ba/lib/src/huge_listview.dart#L202

and try it from your app. If this approach works, we can add it to the plugin.

deakjahn avatar Dec 30 '22 11:12 deakjahn

Thanks. Will do and revert :)

kmarkovych avatar Dec 30 '22 17:12 kmarkovych