Bus*_*pie 2 flutter flutter-layout
我有以下页面:
带有底栏和三页。我想启用垂直滚动,但禁用滑动。
我在 SingleChildScrollView 中使用了建议物理:NeverScrollableScrollPhysics(),但是垂直滚动被禁用,但我仍然可以滑动。
我的代码的一部分:
...
return SingleChildScrollView(
scrollDirection: Axis.vertical,
controller: ScrollController(),
physics: NeverScrollableScrollPhysics(),
child: Container(
child: Column(
children: <Widget>[
Text('AAA'),
Text('AAA'),
Text('AAA'),
Text('AAA'),
...
Run Code Online (Sandbox Code Playgroud)
我用 PageViews 构建了“标签”:
Widget buildPageView() {
return PageView(
controller: pageController,
onPageChanged: (index) {
pageChanged(index);
},
children: <Widget>[
Page1Screen(),
Page2Screen(),
Page3Screen(),
],
);
}
Run Code Online (Sandbox Code Playgroud)
任何建议将非常受欢迎。
只需添加NeverScrollableScrollPhysics()到 -PageView
PageView(
physics: NeverScrollableScrollPhysics(), // add this
controller: pageController,
onPageChanged: (index) {
pageChanged(index);
},
children: <Widget>[
Page1Screen(),
Page2Screen(),
Page3Screen(),
],
),
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2424 次 |
| 最近记录: |