[Solved] RenderBox was not laid out Error in Flutter

In this post, we are going to show you how to solve "RenderBox was not laid out" error in Flutter. This error usually happened while rendering the widget in Flutter App.

Another exception was thrown: RenderBox was not laid out: 
_RenderDecoration#a09f6 relayoutBoundary=up8 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE Another exception was thrown: RenderBox was not laid out:
RenderPointerListener#6dc15 relayoutBoundary=up7 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE Another exception was thrown: RenderBox was not laid out:
RenderSemanticsAnnotations#fa014 relayoutBoundary=up6 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE Another exception was thrown: RenderBox was not laid out:
RenderIgnorePointer#92b89 relayoutBoundary=up5 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE Another exception was thrown: RenderBox was not laid out:
RenderMouseRegion#16447 relayoutBoundary=up4 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE Another exception was thrown: RenderBox was not laid out:
_RenderFocusTrapArea#701fe relayoutBoundary=up3 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE Another exception was thrown: RenderBox was not laid out:
RenderFlex#accec relayoutBoundary=up2 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE Another exception was thrown: RenderBox was not laid out:
RenderRepaintBoundary#84f46 NEEDS-LAYOUT NEEDS-

This error usually happens due to the following errors while rendering the widget in Flutter:

Open the link to see the solution of each error:

If the error occurs due to the ListView(), then use List view like below:

ListView(
  shrinkWrap: true,
  children: [
        
  ],
)
Expanded(
  child:ListView(
      children: [
          
      ],
  ),
)

If the error is caused by TextField() or TextFormField() inside Row() widget, then wrap your TextField() like below:

Row(
  children: [
    Expanded(
      child:TextField()
    )
  ],
)

In this way, you can solve "RenderBox was not laid out" error in Flutter app.

No any Comments on this Article


Please Wait...