title: gridview inside a listview causes Another exception was thrown: RenderBox was not laid out: RenderViewport#45df5 NEEDS-LAYOUT NEEDS-PAINT
body: <p>I am trying to create a widget where I have a listview and one of its children is a gridview.but I get this error:</p>
  
  <blockquote>
    <p>Another exception was thrown: RenderBox was not laid out:
    RenderViewport#45df5 NEEDS-LAYOUT NEEDS-PAIN</p>
  </blockquote>
  
  <p>when I remove the gridview the error goes away.
  here is my code:</p>
  
  <pre><code>ListView(
        children: &lt;Widget&gt;[
          Stack(
            overflow: Overflow.visible,
            children: &lt;Widget&gt;[
              _buildSlider(context),
              _buildAppBar(context),
            ],
          ),
           GridView.builder(
              itemCount: state.homePageData.categories.length,
              gridDelegate:
                  SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2),
              itemBuilder: (BuildContext context, int index) {
                return Card(
                  child: GridTile(
                    header: Text(state.homePageData.categories[index].name),
                    child: Image.network(baseUrl +
                        state.homePageData.categories[index].img.toString(),height: 50,width: 50,),
                  ),
                );
              },
            )
        ],
      )
  </code></pre>