0

I have in my body a tab then a column and in it I call to build a dynamic list of card using the another widget class. All seems to be working fine but I am getting this error.

The following message was thrown during layout:
I/flutter ( 5090): A RenderFlex overflowed by 115 pixels on the bottom.

The issue is that the list is not able to scroll despite me wrapping it into a flexible widget. Here is the code snippet which builds the the list.I have also enable physics: AlwaysScrollableScrollPhysics(), yet the same issue. I know if I fix a particular height it will work but I dont want to to do that cause that defeats the whole idea.

Widget buildDynamicList(BuildContext context) {
    return new Flexible(
                //decoration: new BoxDecoration(border: new Border.all(width: 2.0)),
                //height:double.infinity,

                //fit: FlexFit.loose ,
                child: ListView.builder(
                  physics: AlwaysScrollableScrollPhysics(),
                    shrinkWrap: true,
                      itemCount: vehicles.length,                      
                      itemBuilder: (BuildContext ctxt, int index) {
                        return Row( 
                          mainAxisSize: MainAxisSize.max,
                          //mainAxisSize: MainAxisSize.max, 
                          children: <Widget>[ 
                            RouteTile(index: index)
                         // expansionConfigurableRouteTile(ctxt, index), 
                          ], 
                          );
                      }
                     )    
          );         
}
0

2 Answers 2

2

Flexible only makes your child height variable. It does not make your lists scrollable. In order to do that, wrap your Flexible widget with a SingleChildScrollView widget.

Sign up to request clarification or add additional context in comments.

9 Comments

I tried ready like this new Column( mainAxisSize: MainAxisSize.min, children: <Widget>[ SingleChildScrollView (child: buildDynamicList(context) ) ], );
But it give me error Flexible widget must be placed directly inside a flex widget
@newbie Try it the other way around: put SingleChildScrollView on the outside of Flexible
I switch their placing the same old error on the A RenderFlex overflowed by 115 pixels on the bottom
what else could be the issue I know is just small tweak more I tried adding flex:1 still the same though
|
-1

removing shrinkWrap: true will do the trick

2 Comments

What does shrink wrap do is to enable it to save space right
yes without shrinkWrap: true list is not visible

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.