Home > database >  how do i fix this error: RenderBox was not laid out: RenderRepaintBoundary#16fcb relayoutBoundary=up
how do i fix this error: RenderBox was not laid out: RenderRepaintBoundary#16fcb relayoutBoundary=up

Time:11-29

I have an error that says: RenderBox was not laid out: RenderDecoratedBox#dbfd0 relayoutBoundary=up12 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE. 'package:flutter/src/rendering/box.dart': Failed assertion: line 2001 pos 12: 'hasSize'

How can i fix this error. I have looked at the other questions and didn't came to an solution.

      body: SafeArea(
        child: SingleChildScrollView(
        physics: const BouncingScrollPhysics(),



      child: Container(
        decoration: BoxDecoration(
            gradient: LinearGradient(colors: [
              hexStringToColor("FFBEC8"),
              hexStringToColor("fe98a8"),
              hexStringToColor("FC98A7"),
              hexStringToColor("#FF8799")
            ], begin: Alignment.topCenter, end: Alignment.bottomCenter)),
          child: Padding(
              padding: EdgeInsets.all(16.0),

              child: Column(
                children: <Widget>[
                  Container(

                    height: 64,
                    margin: EdgeInsets.only(bottom: 20),
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: <Widget>[
                        CircleAvatar(
                          radius: 29,
                          backgroundImage: AssetImage(
                              'assets/logo.png'),
                        ),
                        SizedBox(
                          width: 16,
                        ),
                        Column(
                          mainAxisAlignment: MainAxisAlignment.center,
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: <Widget>[
                            Text(

                        "$name",
                              style: TextStyle(
                                  fontFamily: "Montserrat Medium",
                                  color: Colors.white,
                                  fontSize: 20),
                            ),

                          ],
                        )
                      ],
                    ),

                  ),

                  Expanded(
                    child: GridView.count(
                      shrinkWrap: true,
                      mainAxisSpacing: 10,
                      crossAxisSpacing: 10,
                      primary: false,
                      crossAxisCount: 2,

                      children: <Widget>[
                        Card(
                          color: Colors.grey.shade100,
                          shape:RoundedRectangleBorder(
                              borderRadius: BorderRadius.circular(8)
                          ),

                          elevation: 4,
                          child: Column(
                            mainAxisAlignment: MainAxisAlignment.center,

                            children: <Widget>[
                              GestureDetector(
                                onTap:
                          () =>
                              Navigator.of(context).push(PageTransition(
                                  child: PDFScreen(pathPDF: 'assets/arbo',),
                                  type: PageTransitionType.fade)),


                                  child:
                                  SvgPicture.asset(
                                    'assets/moon.svg',
                                    height: 120,
                                  )

                              ),
                              Text(
                                'Arbo-lijst',

                                style: cardTextStyle,
                              )
                            ],
                          ),
                        ),

CodePudding user response:

Remove the singlechildscrollview widget

you cannot use an expanded widget in a singlechildscrollview widget, a singlechildscrollview is a scrollable widget. while the expanded widget is telling your code to take up all the space provided. however, with the scrollable its more infinite to fit all things on the page. Hence the error basically.

Just remove the SingleChildScrollView.

CodePudding user response:

In my case the anwser was to remove the expended widged.

  • Related