Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

flutter - scrolling listview inside listview builder

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?

see image

My snipped code:

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);
                            },
                          ))
                    ],
                  )
                ],
              ));
  }
like image 447
Muhammad Imanudin Avatar asked Nov 27 '22 20:11

Muhammad Imanudin


1 Answers

In your ListView add:

shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),

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

body: Column(
                  children: <Widget>[
                     Filter(),
                     Expanded(
                        child: ListView()
                     ),
                ]
            )
like image 147
anmol.majhail Avatar answered Jan 06 '23 05:01

anmol.majhail