[英]Scrolling with a listview in Flutter
我遇到了 Flutter 的问题,其中我创建的屏幕只有在用户触摸由卡片组成的列表视图周围的填充时才会滚动,而不是在实际列表与其自身交互的情况下滚动。
Widget 树如下所示:
child: Scaffold(
body: SingleChildScrollView(
child: Center(
child: SizedBox(
width: 500.0,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Text(
'List',
),
Container(
child: ListView.builder(
shrinkWrap: true,
itemCount: list.length,
itemBuilder: (context, index) {
return Card(
child: ListTile(
无论用户触摸屏幕的哪个位置,我如何让屏幕可滚动?
在 Listview 中添加NeverScrollableScrollPhysics
ListView.builder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.