Are you seeing the error RenderBox was not laid out: RenderPointerListener#7d3c0 relayoutBoundary=up9 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE?
Table of Contents
Steps to Fix RenderBox was not laid out in Flutter
Are you struggling with the ‘RenderBox was not laid out’ error in Flutter? Get the solution now and learn how to avoid this common issue in your app development.
The following assertion was thrown during performLayout():
RenderFlex children have non-zero flex but incoming height constraints are unbounded.
Consider setting mainAxisSize to MainAxisSize.min and using FlexFit.loose fits for the flexible children (using Flexible rather than Expanded).
This will allow the flexible children to size themselves to less than the infinite remaining space they would otherwise be forced to take, and then will cause the RenderFlex to shrink-wrap the children rather than expand to fit the maximum constraints provided by the parent.
Apply code
Column(
children: [
Expanded(
child: Text(
"Hello friends",
textAlign: TextAlign.justify,
style: TextStyle(
fontSize: 8,
),
),
),
Text(
"How are you ?",
textAlign: TextAlign.justify,
style: TextStyle(
fontSize: textSize,
),
),
],
),
Read: A RenderFlex overflowed by 36 pixels on the right using the row
Remove expanded widget
Remove the expanded widget from the Text widget it solved the issue.
Column(
children: [
Text(
"text",
textAlign: TextAlign.justify,
style: TextStyle(
fontSize: 8,
),
),
Text(
"widget",
textAlign: TextAlign.justify,
style: TextStyle(
fontSize: textSize,
),
),
],
),