使用以下代码时,“我的专栏”将不会滚动:
Flexible(
child: new ListView(
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: AlwaysScrollableScrollPhysics(),
children: <Widget>[
CarsList(uid: widget.uid),
MotorbikeList(uid: widget.uid)
],
)
),
当我将它们分别包装到Flex Widget中时,我可以滚动它们,但是它们在展开时并没有占用列的全部空间。
Flexible(
child: CarsList(uid: widget.uid),
),
Flexible(
child: MotorbikeList(uid: widget.uid),
)
[
答案 0 :(得分:0)
尝试以下代码:
Flexible(
child: new ListView(
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: AlwaysScrollableScrollPhysics(),
children: <Widget>[
Expanded(
child: CustomScrollView(slivers: <Widget>[
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
CarsList(uid: widget.uid),
MotorbikeList(uid: widget.uid)
},
childCount: 2,
),
),
])),
],
));