[Solved] RenderBox was not laid out in Flutter

Are you seeing the error RenderBox was not laid out: RenderPointerListener#7d3c0 relayoutBoundary=up9 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE?

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,

       ),

     ),

 ],

),
Share:
Ambika Dulal

Ambika Dulal is a Flutter Developer from Nepal who is passionate about building beautiful and user-friendly apps. She is always looking for new challenges and is eager to learn new things. She is also a strong believer in giving back to the community and is always willing to help others.

Leave a Comment

AO Logo

App Override is a leading mobile app development company based in Kathmandu, Nepal. Specializing in both Android and iOS app development, the company has established a strong reputation for delivering high-quality and innovative mobile solutions to clients across a range of industries.

Services

UI/UX Design

Custom App Development

Mobile Strategy Consulting

App Testing and Quality Assurance

App Maintenance and Support

App Marketing and Promotion

Contact

App Override

New Plaza, Kathmandu