Support in NestedScrollView + TabbarView(ListView,GridView)
Hi! I'm going to develop feature that [when user click gridview item, then
- change gridview ->listview widget
- scroll to gridview item's index on Listview (e.g. instagram poster interaction)
So, I want to work with this library but I use NestedScrollView with body : TabbarView,(not CustomScrollView) and this library doesn't work
I attach code below
//in controller
AutoScrollController scrollController = AutoScrollController(
axis: Axis.vertical,
suggestedRowHeight: double.infinity,
);
//in view class
NestedScrollView(
controller: controller.scrollController
headerSliver:(something),
body:TabbarView(children:
[
tab1(),
tab2(),
..
]
)
// in tab1 widget,
ListView.builder(
controller: controller.scrollController,
itemCount: list.length + 1,
itemBuilder: (context, index) {
return AutoScrollTag(
key: ValueKey(index),
index: index,
controller: controller.scrollController,
child: (child Widget something)
I register scrollController on NestedScrollView as AutoScrollController type. (At first, I register scrollController individually(on ListView,GridView, NestedScrollView), but scroll interaction either works individually, so I register scrollController only on NestedScrollview)
I also attach a picture of the widget tree to help you understand my case Thank you for read this, and want some help ASAP😭
Any updates on this? 🥲@jerrywell
Hi @kimwest00
It’s actually two different routes. I’m simply listing the idea here:
- Use the grid view without the scroll-to feature.
- When you tap on a cell in the grid view, it will trigger a route with a list view.
- The first item in this list view will be what you just tapped.
- Both the tapped item in the grid view and the list view will use the Hero widget.
- For step 3, the list view will use the center key to keep the scroll offset 0, and allowing for more newer content if any.
- When you want to swipe back from the list view to the grid view, you can reload the grid view and assign the first item (or whichever position) as the one you just swiped from in the list view.
So this feature actually doesn't need the scroll to feature.
Close issue as we have the solution from https://github.com/quire-io/scroll-to-index/issues/112#issuecomment-2216205530