stevenBang / loadmore_listview

An Listview with the Load more item and refresh
MIT License
5 stars 2 forks source link

Fix scrolling issues #1

Open NemesisX1 opened 5 months ago

NemesisX1 commented 5 months ago

I was using this package to implement a load more features in my app and it introduce some bugs in my app: I think that the NotifcationListener widget used to retrieve when the user scroll to the end of the scrollable part was also listening to every scroll end notification that could be also come from another scrolling part.

To fix this I just removed the NotificationListener widget and just add a listener to the _scrollController of the listview in order to make it more simple to check when the user scroll to the end.

I also fix minor writing showed by the lints

stevenBang commented 5 months ago

@NemesisX1 Do you have an error log? How can I reproduce the problem you encountered so that I can double confirm that it has been resolved thanks~~

NemesisX1 commented 5 months ago

@stevenBang Hello he I don't have an error log, but I can help you to reproduce it.

I had a ListView with some ListView as children. The listview children were horizontal to display elements. Both the parent and the children were loaded dynamically

I saw that when I scroll a children's listview to the end the scroll controller of the parent took me to the end of the parent listview or a random part of the scroll. When I reached the end of the parent listview, my screen froze or started calling the onLoadMore function many times and I could not scroll to the top again.

I found that it was because NotificationListener also seems to listen to the children's scroll behaviour. So with many listviews, it probably leads to those issues.

In this PR I just replaced the NotifcationListener with a scrollController that listens to the main ListView and not to the potential children It could have