quire-io / scroll-to-index

scroll to index with fixed/variable row height inside Flutter scrollable widget
MIT License
510 stars 104 forks source link

Scroll to index stops working for AutomaticKeepAlive widgets #106

Open PT10 opened 1 year ago

PT10 commented 1 year ago

Hi,

This is indeed a great library and working quite well until we have widgets which we want to keep alive throughout. In our case the inner widgets (of the ListView) are quite heavy. So want to load them only first time and then preserve their state forever for a smooth scrolling experience.

What we have observed is that if the child element inside the ListView uses AutomaticKeepAliveClientMixin with wantKeepAlive set to true, the scroll to index stops working if you go back and forth few times. I think it has something to do with the tagMap you maintain internally. Please let me know if there is any solution to this problem.

Thanks Prasad

jerrywell commented 1 year ago

Hi, glad to hear you love it : D for this issue, may you provide the simple code example for debug?

vanlooverenkoen commented 3 months ago

I had something similar. I had a Sliver, and the Sliver.builder had this setup

addAutomaticKeepAlives: false

Going form 1 to 10 (index) was working just fine But going back resulted in a rebuild of the whole page.

The addAutomaticKeepAlives: false was not required in my case anymore so I was able to remove it and everything worked fine.

KojackNguyen commented 2 months ago

@PT10 hi sir, did you fixed this issue ? Can you provide simple source code have this issue ? Thanks

linhtn1nws commented 2 months ago

Any update ?