superlistapp / super_sliver_list

Drop-in replacement for SliverList and ListView that can handle large amount of items with variable extents and reliably jump / animate to any item.
https://superlistapp.github.io/super_sliver_list/
MIT License
280 stars 15 forks source link

super_sliver_list adds initial value configuration #69

Open maxfrees opened 2 weeks ago

maxfrees commented 2 weeks ago

I have a requirement. If I have 5000 options, I hope to use super_sliver_list to display them in the bottomSheet. How can I set the initial value so that the initial value can be displayed in the center?

If I have 5000 data, and if I set the initial value to 2000, I expect that when I open the bottomSheet, the 2000 th option will be centered

image

knopp commented 2 weeks ago

There is no initial index in SuperSliverList. Right now you have to layout the SliverList at least once (for one frame) in order to jump to an item. This is something I'd want to figure out eventually but it's quite difficult since scroll offset estimation depends on viewport being available, which is only after first build.