DEV Community

MANOJ AP
MANOJ AP

Posted on • Updated on

Flutter listview crashes in Column widget

Flutter

Listview and Column Widget

Sometimes you may want to combine UI vertically along the screen, that’s were we need a Column Widget.

When I tried to place a search box, a customized Text widget, and ListView widget, Flutter shower with errors.

Column(
children: [
SearchBox(hintText: 'Search', controller: textController),
ListView.builder(
// the number of items in the list
itemCount: adList.length,

This happens because in the column widget Listview didn’t fit. To make it adjustable for the column wrap the ListView with Expanded widget, in case of Vertical listview.

The expanded widget can have single child widget.

Column(
children: [
SearchBox(hintText: 'Search', controller: textController),
Expanded(
child: ListView.builder(

and it should solve the issue.

Following Flutter posts deserve a good read

Flutter Desktop Support - OpenSuse
Flutter support for Windows

Top comments (0)