flutter PageView 禁止左右滚动

开发app中,首页会经常使用到PageView,首页又不需要滑动,这个时候就需要关闭系统自带的左右滑动效果

效果如下:

PageView.builder(
                itemBuilder: (BuildContext context, int index) =>
                    tabBodies[index],
                controller: _pageController,
                itemCount: tabBodies.length,
                physics: NeverScrollableScrollPhysics(),
                onPageChanged: (int index) {
                  Provide.value<CurrentIndexProvide>(context)
                      .changeIndex(index);
                },
              )


更多详解:
喜欢可以加Q群号:913934649,点赞,评论;

简书: https://www.jianshu.com/u/88db5f15770d

csdn:https://me.csdn.net/beyondforme

掘金:https://juejin.im/user/5e09a9e86fb9a016271294a7

发布了159 篇原创文章 · 获赞 30 · 访问量 6万+

猜你喜欢

转载自blog.csdn.net/beyondforme/article/details/104135702