scroll-to-index icon indicating copy to clipboard operation
scroll-to-index copied to clipboard

Scroll to index stops working for AutomaticKeepAlive widgets

Open PT10 opened this issue 2 years ago • 4 comments

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

PT10 avatar Jul 15 '23 09:07 PT10

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

jerrywell avatar Jul 27 '23 13:07 jerrywell

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.

vanlooverenkoen avatar Jun 14 '24 13:06 vanlooverenkoen

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

KojackNguyen avatar Jun 24 '24 12:06 KojackNguyen

Any update ?

linhtn1nws avatar Jun 24 '24 12:06 linhtn1nws