垂直向上滚动后,水平ListView会向右滚动。
仅在显示水平Listview时手指不再触摸触摸屏并且垂直SliverList继续自行运行时,才会发生错误。
以下是重现该错误的代码:
Widget build(BuildContext context) {
return CustomScrollView(
slivers: <Widget>[
SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) {
if (index == 0)
return SizedBox(
height: 50,
child: ListView.builder(
itemBuilder: (context, index) => Container(
width: 200,
color: Colors.black45,
margin: const EdgeInsets.symmetric(horizontal: 8),
),
scrollDirection: Axis.horizontal,
),
);
return Container(
height: 200,
margin: const EdgeInsets.symmetric(vertical: 8),
color: Colors.black45,
);
},
),
)
],
);
}