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
283 stars 17 forks source link

jumpToItem() and animateToItem() don't work if center and anchor are set #59

Open simc opened 4 months ago

simc commented 4 months ago

I have a CustomScrollView with two SuperSliverLists and they are centered in the CustomScrollView using the center and anchor properties. For both lists jumpToItem() and animateToItem() either don't work at all or jump to the wrong index.

CustomScrollView(
  controller: controller,
  center: centerKey,
  anchor: 0.5,
  cacheExtent: 2000,
  slivers: [
    SuperSliverList(
      listController: listController1,
      ...,
    ),
    SuperSliverList(
      key: centerKey,
      listController: listController2,
      ...,
    ),
  ],
),
knopp commented 4 months ago

Mixing normal and reverse growth direction slivers in single scroll view is not supported. This seems pretty difficult to do since the slivers before affect the target scroll position. That said, if somebody submits a PR for this I'll be more than happy to review :)