Closed perret123 closed 4 months ago
I don't think this can work easily. NestedScrollView is bit of a hack. First of all, the controller you're passing to animateTo
only controlls the nested scroll view has only has extent range of 0 - 150. You would need to access the inner controller from the build context right above SuperSliverList
through PrimaryScrollController.of(context)
. The problem is, that this scroll controller has no idea about the overlap, which is handled by nested scroll view and forwarded down to the first sliver.
Okidoki, I made a hacky solution that scrolls the parent ScrollController
(from the NestedScrollView
) when the inner ScrollController
of the CustomScrollView
with the SuperSliverList
is scrolled - it may not be the most performant or beautiful, but I guess it is good enough until we get even better out-of-the-box support for nested slivers.
Thank you for this package. It works quite well, but I found a Use-Case which doesn't seem to work.
I use a
NestedScrollView
with aSliverHeader
and aTabBar
with twoTabBarView
s inside. Inside theTabBarViews
I use aCustomScrollView
as per the example available here: https://api.flutter.dev/flutter/widgets/NestedScrollView-class.htmlSo far so good, now inside the
CustomScrollView
I wanted to use the cool functionalities you offer; Checking thevisibleRange
with theListController
listener (this works great!) and jump or animate to the index inside theSuperSliverList
.I made an example app which shows what I want to achieve; Inside the Products-Tab, I want to click on a category and animate to the index in the
SuperSliverList
. When I click on the first two categories, something still works. You can check if you press on "Snacks" it still scrolls down, but pressing on "Chocolates" doesn't do anything.Thank you for looking at this, if you make this work it would be spectacular because it seems the "godfather" of indexed lists also has its problems when it comes to NestedScrollViews; https://github.com/google/flutter.widgets/issues/32. Thank you.
Video: https://github.com/superlistapp/super_sliver_list/assets/1687252/19a38da4-ada2-43f1-b14b-76717f2d0a4c
Sourcecode: