Moved the building of the task list to a separate method
This commit is contained in:
parent
7b6b24a190
commit
f59f491022
1 changed files with 16 additions and 12 deletions
|
|
@ -54,18 +54,7 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||
return Stack(
|
||||
overflow: Overflow.visible,
|
||||
children: <Widget>[
|
||||
ListView(
|
||||
padding: EdgeInsets.only(top: _searchBoxHeight + 15),
|
||||
children: snap.data
|
||||
.map((task) => Container(
|
||||
child: TaskListTile(
|
||||
task: task,
|
||||
onDone: () => bloc.markTaskAsDone(task),
|
||||
),
|
||||
padding: EdgeInsets.only(bottom: 12),
|
||||
))
|
||||
.toList(),
|
||||
),
|
||||
buildTasksList(snap.data),
|
||||
// This container is needed to make it seem like the search box is
|
||||
// part of the app bar.
|
||||
Container(
|
||||
|
|
@ -81,6 +70,21 @@ class _HomeScreenState extends State<HomeScreen> {
|
|||
);
|
||||
}
|
||||
|
||||
Widget buildTasksList(List<TaskModel> tasks) {
|
||||
return ListView(
|
||||
padding: EdgeInsets.only(top: _searchBoxHeight + 15),
|
||||
children: tasks
|
||||
.map((task) => Container(
|
||||
child: TaskListTile(
|
||||
task: task,
|
||||
onDone: () => bloc.markTaskAsDone(task),
|
||||
),
|
||||
padding: EdgeInsets.only(bottom: 12),
|
||||
))
|
||||
.toList(),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildSearchBox() {
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue