【发布时间】:2021-03-30 12:43:38
【问题描述】:
我有一个水平的 PageView,每个页面上有一些嵌套的垂直 LIstView。
问题是我无法滚动那些嵌套的列表视图,因为我只注册了PageView 手势。
注意:当我在customSCrollView 内使用SliverChildBuilderDelegate 时没有限制,滚动实际上是活动的,但其他一切都没有
这就是代码的样子
class ProductDetail extends StatefulWidget {
@override
State<StatefulWidget> createState() => ProductDetailState();
}
class ProductDetailState extends State {
@override
Widget build(BuildContext context) {
return Material(
child: DefaultTabController(
length: 2,
child: Column(
children: [
Expanded(
child: NestedScrollView(
// physics: BouncingScrollPhysics(),
headerSliverBuilder:
(BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[];
},
body: PageView( // this is a pageView container
children: <Widget>[
CustomScrollView(
slivers: [
SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) {
return ListTile(
title: Text('index $index'),
);
},
childCount: 10
),
)
]
),
CustomScrollView(
slivers: [
SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) {
return ListTile(
title: Text('index $index'),
);
},
childCount: 10
),
)
]
),
],
),
),
),
Container(
height: 30,
// child:
)
],
),
),
);
}
}
【问题讨论】:
-
你能发布一个最小的可重现代码吗?
-
更新了代码,请看@iDecode