How to “merge” scrolls on a TabBarView inside a PageView?

后端 未结 2 1411
傲寒
傲寒 2021-01-03 15:58

I have an app that uses a PageView on its main page. Today, I got assigned to insert a TabBarView in one of these pages. The problem is that when I scroll the between the ta

2条回答
  •  死守一世寂寞
    2021-01-03 16:20

    so you want to scroll the page view to the left when you reach the end of tabs and the same goes to scrolling to the right when on the first tab, what i have been thinking about is manually swipe the page view when in those cases as follow:

    index value should the index of page that comes before the tab bar page and after it.

    pageController.animateToPage(index,
              duration: Duration(milliseconds: 500), curve: Curves.ease); 
    

    here is a complete code of what you are looking for, hopefully this helps!

提交回复
热议问题