flutter ListView嵌套ListView滚动问题

【flutter ListView嵌套ListView滚动问题】在flutter开发中ListView嵌套ListView时,俩个ListView都会滚动,而不是一个整体,只需要设置子组件不滚动,并设置高度就可以解决这个问题

Widget build(BuildContext context) { return ListView( children: [ Container( child: SwiperPage(), height: 200.0, ), Container( child: bookList(), ), ], ); }Widget childList() { return ListView.builder( shrinkWrap: true, //解决无限高度问题 physics: new NeverScrollableScrollPhysics(), //禁用滑动事件 itemCount: 20, itemBuilder: (BuildContext context, int index) { return Container( margin: EdgeInsets.only(top: 20), padding: EdgeInsets.only(left: 20), child: Text('aaaaa' + index), ); }); }

    推荐阅读