diff --git a/examples/flutter_todos/lib/todos_overview/view/todos_overview_page.dart b/examples/flutter_todos/lib/todos_overview/view/todos_overview_page.dart index 3d63eea3129..97880af4302 100644 --- a/examples/flutter_todos/lib/todos_overview/view/todos_overview_page.dart +++ b/examples/flutter_todos/lib/todos_overview/view/todos_overview_page.dart @@ -100,31 +100,32 @@ class TodosOverviewView extends StatelessWidget { } return CupertinoScrollbar( - child: ListView( - children: [ - for (final todo in state.filteredTodos) - TodoListTile( - todo: todo, - onToggleCompleted: (isCompleted) { - context.read().add( - TodosOverviewTodoCompletionToggled( - todo: todo, - isCompleted: isCompleted, - ), - ); - }, - onDismissed: (_) { - context - .read() - .add(TodosOverviewTodoDeleted(todo)); - }, - onTap: () { - Navigator.of(context).push( - EditTodoPage.route(initialTodo: todo), - ); - }, - ), - ], + child: ListView.builder( + itemCount: state.filteredTodos.length, + itemBuilder: (_, index) { + final todo = state.filteredTodos.elementAt(index); + return TodoListTile( + todo: todo, + onToggleCompleted: (isCompleted) { + context.read().add( + TodosOverviewTodoCompletionToggled( + todo: todo, + isCompleted: isCompleted, + ), + ); + }, + onDismissed: (_) { + context + .read() + .add(TodosOverviewTodoDeleted(todo)); + }, + onTap: () { + Navigator.of(context).push( + EditTodoPage.route(initialTodo: todo), + ); + }, + ); + }, ), ); },