title: Flutter: how to fix bottom overflow
body: <p>I have a Flutter Widget with a column layout that has two Containers, one of which has a <code>ListView.builder</code>. When the page renders I get a</p>
  
  <blockquote>
    <p>bottom overflow by 169px</p>
  </blockquote>
  
  <p>and I'm not sure how to fix it. </p>
  
  <p>I've googled around for solutions and have tried various things like wrapping one or more of the <code>Container</code>s in the widget in an <code>Expanded</code> widget, but that doesn't work either. If I wrap just the <code>Container</code> that has the <code>FutureBuilder</code> inside of it in an <code>Expanded</code>, then the <code>ListView</code> doesn't render at all and I see errors like:</p>
  
  <pre><code>I/flutter ( 3516): Another exception was thrown: RenderFlex children have non-zero flex but incoming height constraints are unbounded.
  I/flutter ( 3516): Another exception was thrown: RenderBox was not laid out: RenderFlex#0caf9 relayoutBoundary=up2 NEEDS-PAINT
  I/flutter ( 3516): Another exception was thrown: RenderBox was not laid out: RenderFlex#963f4 relayoutBoundary=up1 NEEDS-PAINT
  I/flutter ( 3516): Another exception was thrown: NoSuchMethodError: The method '&lt;=' was called on null.
  </code></pre>
  
  <p>This is what the build function of my Widget looks like:</p>
  
  <pre><code>  Widget build(BuildContext context) {
      return Container(
          child: Column(children: &lt;Widget&gt;[
        Container(
            height: 40,
            color: Colors.grey.withOpacity(0.5),
            child: Padding(
                padding: const EdgeInsets.fromLTRB(10.0, 2.0, 10.0, 2.0),
                child: TextField(
                    autofocus: false,
                    controller: searchFilterController,
                    keyboardType: TextInputType.text,
                    maxLines: 1,
                    decoration: InputDecoration(
                        border: InputBorder.none,
                        filled: true,
                        fillColor: Colors.white.withOpacity(1),
                        hintText: 'Search',
                        suffixIcon: Icon(
                          Icons.search,
                          color: Colors.grey,
                        )),
                    onChanged: (value) {
                      filter = value;
                    }))),
  
        Container(
            child: FutureBuilder&lt;UserPantry&gt;(
          future: UserPantryDao.getUserPantry(widget.userId),
          builder: (context, snapshot) {
            if (snapshot.hasData) {
              widget.ingredientList.clear();
              if (filter == null || filter.trim() == "") {
                widget.ingredientList.addAll(snapshot.data.ingredients);
              } else {
                for (UserIngredient ingredient in snapshot.data.ingredients) {
                  if (ingredient.ingredient.name
                      .toLowerCase()
                      .contains(filter.toLowerCase())) {
                    widget.ingredientList.add(ingredient);
                  }
                }
              }
  
              return ListView.builder(
                  shrinkWrap: true,
                  itemCount: widget.ingredientList.length,
                  itemBuilder: (BuildContext context, int index) {
                    return ListTile(
                        title: Text(
                      widget.ingredientList[index].ingredient.name,
                      style: TextStyle(fontSize: 20.0),
                    ));
                  });
            } else if (snapshot.hasError) {
              print(snapshot.error);
              return Text(
                  "An error occurred while loading your pantry. Please try again.");
            }
            //By default just show an empty container.
            return Container();
          },
        ))
      ]));
    }
  </code></pre>