Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Incorrect use of ParentDataWidget Error Flutter

I’m trying to display grid view, but I got an error saying "Incorrect use of ParentDataWidget".

Here is my code:

 body: Container {
    ...
    child: Column {
       children : [
          Container {
             child: GridView(
                gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                   crossAxisCount: 4,
                ),
                children: [
                   CircleAvatar(
                      child: Icon(
                         Icons.person,
                      ),
                      backgroundColor: Colors.black,
                    ),
                    CircleAvatar(
                      child: Icon(
                         Icons.person,
                      ),
                      backgroundColor: Colors.black,
                    ),
                    CircleAvatar(
                      child: Icon(
                         Icons.person,
                      ),
                      backgroundColor: Colors.black,
                    ),
                ]
             )
          }
       ]
    }
 }

And here is the error:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

  • Incorrect use of ParentDataWidget.
  • Vertical viewport was given unbounded height.
  • RenderBox was not laid out: RenderViewport#8c1a9 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
    ‘package:flutter/src/rendering/box.dart’:
    Failed assertion: line 1927 pos 12: ‘hasSize’

Any solutions?

>Solution :

On your GridView provide shrinkWrap: true,. This is also discussed Flutter Gridview in Column.

child: GridView(
  shrinkWrap: true,
  gridDelegate: 
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading