Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support in NestedScrollView + TabbarView(ListView,GridView) #112

Open
kimwest00 opened this issue Mar 23, 2024 · 2 comments
Open

Support in NestedScrollView + TabbarView(ListView,GridView) #112

kimwest00 opened this issue Mar 23, 2024 · 2 comments

Comments

@kimwest00
Copy link

Hi!
I'm going to develop feature that
[when user click gridview item, then

  1. change gridview ->listview widget
  2. 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😭

image

@kimwest00
Copy link
Author

Any updates on this? 🥲@jerrywell

@jerrywell
Copy link
Member

Hi @kimwest00

It’s actually two different routes. I’m simply listing the idea here:

  1. Use the grid view without the scroll-to feature.
  2. When you tap on a cell in the grid view, it will trigger a route with a list view.
  3. The first item in this list view will be what you just tapped.
  4. Both the tapped item in the grid view and the list view will use the Hero widget.
  5. 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.
  6. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants