简体   繁体   English

在 Flutter 中使用列表视图滚动

[英]Scrolling with a listview in Flutter

I'm having issues with Flutter wherein a screen I have created will only scroll if the user touches the padding surrounding a listview comprised of cards, and not if the actual list is interacted with itself.我遇到了 Flutter 的问题,其中我创建的屏幕只有在用户触摸由卡片组成的列表视图周围的填充时才会滚动,而不是在实际列表与其自身交互的情况下滚动。

The Widget tree looks similar to as below: 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(

How would I go about making the screen scrollable regardless of where on the screen the user touches?无论用户触摸屏幕的哪个位置,我如何让屏幕可滚动?

Add NeverScrollableScrollPhysics in Listview在 Listview 中添加NeverScrollableScrollPhysics

ListView.builder(
                shrinkWrap: true,
                physics: NeverScrollableScrollPhysics(),

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM