Flutter: "RenderFlex children have non-zero flex but incoming height constraints are unbounded"
Wrap your Column
inside an Expanded
or SizedBox
(with some height
) like this:
Expanded(
child: Column(...)
)
OR
SizedBox(
height: 200, // Some height
child: Column(...),
)
Try to wrap of Column
or any of other Widget in Expanded
or Flexible
and it Will be done.
And Don't forget to give some height to the Scrolling widgets
The fix for this above issue, is to Wrap the Column
widget inside a Expanded
widget. Example below.
Expanded(
child: Column(
children: <Widget>[
Container(
height: 400,
width: 400,
child: ListView.builder(
itemCount: 2,
itemBuilder: (context, position) {
return Card(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Text("e.g., those that are not Expanded"),
),
);
},
),
),
],
),
)
To understand more see this : “RenderFlex children have non-zero flex…”
This approach never fails me:
Card(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus finibus luctus tortor id pulvinar. Donec sollicitudin, dui vitae aliquam tristique, eros risus commodo enim, eget lobortis arcu velit ac arcu. "),
Text("Nunc tristique, ex ut volutpat feugiat, nulla nibh iaculis lectus, laoreet auctor justo tellus quis mi. Praesent ut interdum sem. Donec eget finibus augue, et vehicula elit. Praesent eu euismod arcu, eu maximus tellus. Ut diam est, sodales nec enim a, pharetra lobortis erat."),
]
)
)