Extracted the list building on the events screen to a separate method, updated the firebase function to handle updates on the "done" field in tasks

This commit is contained in:
Mariano Uvalle 2019-04-27 19:24:56 -05:00
parent dfe52b77ef
commit 09555aeadf
3 changed files with 23 additions and 14 deletions

View file

@ -52,23 +52,27 @@ class _EventsScreenState extends State<EventsScreen> {
child: LoadingIndicator(),
);
}
return ListView(
padding: EdgeInsets.only(top: 15),
children: eventsSnap.data
.map(
(event) => Padding(
padding: EdgeInsets.only(bottom: 15),
child: EventListTile(
event: event,
),
),
)
.toList(),
);
return buildList(eventsSnap.data);
},
),
);
},
);
}
Widget buildList(List<EventModel> events) {
return ListView(
padding: EdgeInsets.only(top: 15),
children: events
.map(
(event) => Padding(
padding: EdgeInsets.only(bottom: 15),
child: EventListTile(
event: event,
),
),
)
.toList(),
);
}
}