title: How can I have the GridView.builder build from the top when placed in a container in Flutter?
body: <p>When I place the GridView.builder inside a container of a certain size (so the GridView.builder only takes up this parent's size), I can't seem to get it the children to build from the top down.</p>
  <p>Instead, there is a gap at the top before it starts building and none at the bottom. I have tried using the Align widget and the GridView.builder parameters but I can't get it to adjust this.</p>
  <p>How can I change this so the children can build from the top down (or even center the children with equal blank space at the top and bottom)?</p>
  <p>Here is simplified code:</p>
  <pre><code>
  import 'package:flutter/material.dart';
  
  class GridViewExample extends StatefulWidget {
    const GridViewExample({Key? key}) : super(key: key);
  
    @override
    _GridViewExampleState createState() =&gt; _GridViewExampleState();
  }
  
  class _GridViewExampleState extends State&lt;GridViewExample&gt; {
    @override
    Widget build(BuildContext context) {
      return Center(
        child: Container(
          alignment: Alignment.topCenter,
          color: Colors.blue,
          width: 200,
          height: 500,
          child: GridView.builder(
            itemCount: 50,
            gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
              crossAxisCount: 2,
              crossAxisSpacing: 5,
            ),
            itemBuilder: (context, index) =&gt; Padding(
              padding: const EdgeInsets.all(8.0),
              child: Container(
                color: Colors.orange,
              ),
            ),
          ),
        ),
      );
    }
  }
  
  
  [![GridImage][1]][1]
  
  
    [1]: https://i.stack.imgur.com/gjuRX.png
  </code></pre>