首页 > 解决方案 > 如何启用在 TabBarView 父级中禁用的 Listview 滚动

问题描述

ListView 类是一个可滚动的小部件列表。我在 ListView 类的父级中禁用了水平滚动,并在子级(ListView 类)中受到此代码的影响:

new Stack(
    ...,
    children: <Widget>[
        ...,
        new TabBarView(
            ...,
            children: icons.map((Icon icon) {
                ...,
                return new Container(
                    ...,
                    child:new Card(
                        ...,
                        child: new Stack(
                            ...,
                            children: <Widget>[
                                ...,
                                new Container(
                                    ...,
                                    new ListView(// enable scrolling here
                                        ...
                                        children: <Widget>[
                                            ...
                                        ],
                                    ),
                                ),
                            ],
                        ),
                    ),
                ),
            }).toList()
        ),
        new GestureDetector(
            behavior: HitTestBehavior.opaque,
        ),
    ],
),

现在我想在我在代码中注释的内部 ListView 类中使用滚动。

标签: androidiosdartflutter

解决方案


推荐阅读