flutter-在listview生成器中滚动listview [英] flutter - scrolling listview inside listview builder

查看:79
本文介绍了flutter-在listview生成器中滚动listview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个过滤器",下面是足球比赛的列表.我用ListView包装"Filter and" listview builder"(这样就解决了blablabla下的重载问题).但是,当您正常滚动时,会有一些奇怪的事情.滚动到无效的列表.只有一个发光效果",但是我从上面的过滤器菜单"滚动,滚动条起作用.如何使滚动正常运行?

I have a 'Filter' and below that is a list of soccer matches. I Wrap 'Filter and' listview builder' with a ListView (so that the overload writing under blablabla is resolved). But there is something strange when you scroll normally. scroll to the list that doesn't work. there is only a 'glow effect', but I scroll from the 'Filter menu' above, the scroll works. How do I make the scroll run normally?

我的代码片段:

Widget _buildListView(FixtureModel model, BuildContext context) {
    return Container(
        child: model.getFixturesCount() == 0
            ? Center(child: Text('No fixtures found'))
            : ListView(
                shrinkWrap: true,
                children: <Widget>[
                  Column(
                    children: <Widget>[
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: <Widget>[
                          Container(
                              padding: EdgeInsets.only(left: 10.0),
                              child: InkWell(
                                onTap: () => _onTap(context),
                                child: Container(
                                    margin:
                                        EdgeInsets.only(top: 5.0, bottom: 5.0),
                                    child: Row(
                                      children: <Widget>[
                                        Container(
                                            padding: EdgeInsets.only(left: 5.0),
                                            child:
                                                Icon(FontAwesomeIcons.github)),
                                        Container(
                                          padding: EdgeInsets.only(left: 15.0),
                                          child: Text(
                                            'Liga Premier Inggris',
                                            style: TextStyle(
                                                fontSize: 16.0,
                                                fontWeight: FontWeight.w500),
                                          ),
                                        ),
                                        Container(
                                            padding: EdgeInsets.only(
                                                left: 5.0, top: 2.0),
                                            child: Icon(Icons.arrow_drop_down,
                                                size: 17.0))
                                      ],
                                    )),
                              )),
                          Container(
                            padding: EdgeInsets.only(top: 3.0),
                            child: Text(
                              '4',
                              style:
                                  TextStyle(fontSize: 13.0, color: Colors.grey),
                            ),
                          ),
                          IconButton(
                              iconSize: 20.0,
                              icon: Icon(
                                FontAwesomeIcons.calendarAlt,
                                color: Colors.blue,
                              ),
                              onPressed: () {})
                        ],
                      ),
                      Divider(
                        height: 0.0,
                      ),
                      Container(
                          padding: EdgeInsets.only(top: 2.0),
                          child: ListView.builder(
                            shrinkWrap: true,
                            itemCount: model.fixtureList == null
                                ? 0
                                : model.getFixturesCount(),
                            itemBuilder: (context, int i) {
                              var fixture = model.fixtureList[i];

                              return FixtureListItem(fixture: fixture);
                            },
                          ))
                    ],
                  )
                ],
              ));
  }

推荐答案

在您的ListView中添加:

In your ListView add:

shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),

要从ListView中取出过滤器:删除物理学:NeverScrollableScrollPhysics(),然后在ListView中

To take Out Filter From ListView: remove physics: NeverScrollableScrollPhysics(), then in ListView

body: Column(
                  children: <Widget>[
                     Filter(),
                     Expanded(
                        child: ListView()
                     ),
                ]
            )

这篇关于flutter-在listview生成器中滚动listview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆