4

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);
                            },
                          ))
                    ],
                  )
                ],
              ));
  }
9
  • In your ListView -add shrinkWrap: true, physics: NeverScrollableScrollPhysics() Commented Nov 5, 2018 at 5:17
  • @anmol.majhail hello sir, hope you are in good condition. do you understand my problem this stackoverflow.com/questions/53293164/… ? Commented Nov 14, 2018 at 5:44
  • yes, You need to make Tab Bars Data Persistent - for - DetailMatchTab(widget.fixture) class use AutomaticKeepAliveClientMixin , comment article give good example of that - medium.com/@diegoveloper/… Commented Nov 14, 2018 at 6:03
  • class _DetailMatchTabState extends State<DetailMatchTab> with AutomaticKeepAliveClientMixin<DetailMatchTab> {} Commented Nov 14, 2018 at 6:06
  • @anmol.majhail yeah, i added that before see pastebin.com/5wENUb1j Commented Nov 14, 2018 at 6:16

1 Answer 1

28

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()
                     ),
                ]
            )
Sign up to request clarification or add additional context in comments.

7 Comments

Wow ... cool, thanks you for your help. one thing, is it possible that the 'filter' is standing upright then when the scroll is just a list that moves?
Yes Move the Filter Out of ListView, In Column 1st Widget - Filter 2nd Listview. body: Column children: <Widget>[Filter(),Expanded (ListView())] i Updated answer with Code
nice dude.. you save my day, very much help.
@Muhammad - will check later as m outside now.
(y) I made it transparent, a little layout to make it look stacked on sliverlist & sliverappbar. thanks thank you sir,
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.