Fixed a bug where the home screen bloc was fetching the current event by id and not by name

This commit is contained in:
Mariano Uvalle 2019-04-06 22:00:07 -06:00
parent 3b9f702a37
commit b39a490384
2 changed files with 52 additions and 34 deletions

View file

@ -121,7 +121,8 @@ class HomeBloc {
/// Updated the global selected event.
void updateSelectedEvent(TaskModel task) async {
final userModel = await _auth.getCurrentUserModel();
final event = await _firestore.getEvent(userModel.id, eventId: task.event);
final event =
await _firestore.getEvent(userModel.id, eventName: task.event);
_selectionService.updateSelectedEvent(event);
}

View file

@ -11,15 +11,20 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
/// The title for the app bar.
final String title;
CustomAppBar({this.title = ''});
/// Widget to be shown on the bottom of the app bar.
final PreferredSize bottom;
/// the preferred size for this widget.
final Size preferredSize;
CustomAppBar({
this.title = '',
this.bottom,
}) : preferredSize =
Size.fromHeight(140.0 + (bottom?.preferredSize?.height ?? 0));
Widget build(BuildContext context) {
return Material(
elevation: 10.0,
child: Container(
color: Theme.of(context).canvasColor,
child: SafeArea(
child: Container(
Widget result = Container(
height: preferredSize.height,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -47,12 +52,24 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
),
],
),
),
);
if (bottom != null) {
result = Column(
children: <Widget>[
result,
bottom,
],
);
}
return Material(
elevation: 10.0,
child: Container(
color: Theme.of(context).canvasColor,
child: SafeArea(
child: result,
),
),
);
}
@override
final preferredSize = Size.fromHeight(140.0);
}