RenderBox was not laid out: RenderRepaintBoundary#09022 relayoutBoundary

The following assertion was thrown during paint():
RenderBox was not laid out: RenderRepaintBoundary#09022 relayoutBoundary=up1 NEEDS-PAINT
‘package:flutter/src/rendering/box.dart’:
Failed assertion: line 1979 pos 12: ‘hasSize’

The following assertion was thrown during performResize():
Vertical viewport was given unbounded height.
Viewports expand in the scrolling direction to fill their container. In this case, a vertical viewport was given an unlimited amount of vertical space in which to expand. This situation typically happens when a scrollable widget is nested inside another scrollable widget.
If this widget is always nested in a scrollable widget there is no need to use a viewport because there will always be enough vertical space for the children. In this case, consider using a Column instead. Otherwise, consider using the "shrinkWrap" property (or a ShrinkWrappingViewport) to size the height of the viewport to the sum of the heights of its children.

Hello everyone, this has already been applied before, everything worked, but now I’m getting an error that my list gets an unlimited height. What is the problem?

In Flowers.shoppingBasket – an array consisting of words (pieces 5 +-)

Flowers.shoppingBasket = await SharedPreferencesUtil.getData<StringList>("header");

return Scaffold(
      body: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Center(
            child: Column (
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Container(
                      width: 500,
                      height: 650,
                      child: 
ListView.builder(
  controller: controller,
  padding: EdgeInsets.all(5),
  itemCount: Flowers.shoppingBasket!.length,
  itemBuilder: (context, index) {
    if (index < Flowers.shoppingBasket!.length)  {
      return Container(
        padding: EdgeInsets.all(5),
        margin: EdgeInsets.all(2),
        decoration: const BoxDecoration(
            border: Border(bottom: BorderSide(color: Colors.black))
        ),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Container(
              width: 200,
              child: Column(
                children: [
                  Container(
                    margin: EdgeInsets.all(5),
                    child: Text(' ${Flowers.shoppingBasket?[index]}', style: TextStyle(fontSize: 15),),
                  ),

                ],
              ),
            ),

          ],
        ),

      );

    } else {
   ............
     
    }
  }
)

>Solution :

Wrap your ListView.builder with Expanded widget.

Expanded(
  child: ListView.builder(
      padding: EdgeInsets.all(5),

I will recommend to check this video

Leave a Reply