I've the following page:
With a bottombar and three pages. I want to enable vertical scrolling, but disable the swipe.
I used the suggestion physics: NeverScrollableScrollPhysics() in a SingleChildScrollView, but then the vertical scrolling is disabled, but I still can swipe.
A part of my code:
...
return SingleChildScrollView(
scrollDirection: Axis.vertical,
controller: ScrollController(),
physics: NeverScrollableScrollPhysics(),
child: Container(
child: Column(
children: <Widget>[
Text('AAA'),
Text('AAA'),
Text('AAA'),
Text('AAA'),
...
I build the 'tabs' with PageViews:
Widget buildPageView() {
return PageView(
controller: pageController,
onPageChanged: (index) {
pageChanged(index);
},
children: <Widget>[
Page1Screen(),
Page2Screen(),
Page3Screen(),
],
);
}
Any suggestions would be very welcome.
Simply add NeverScrollableScrollPhysics()
to - PageView
PageView(
physics: NeverScrollableScrollPhysics(), // add this
controller: pageController,
onPageChanged: (index) {
pageChanged(index);
},
children: <Widget>[
Page1Screen(),
Page2Screen(),
Page3Screen(),
],
),
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.