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. /// Updated the global selected event.
void updateSelectedEvent(TaskModel task) async { void updateSelectedEvent(TaskModel task) async {
final userModel = await _auth.getCurrentUserModel(); 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); _selectionService.updateSelectedEvent(event);
} }

View file

@ -11,48 +11,65 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
/// The title for the app bar. /// The title for the app bar.
final String title; 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) { Widget build(BuildContext context) {
Widget result = Container(
height: preferredSize.height,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
IconButton(
icon: Icon(
FontAwesomeIcons.arrowLeft,
color: Color.fromRGBO(112, 112, 112, 1),
),
onPressed: () => Navigator.of(context).pop(),
),
SizedBox(
height: 10,
),
Padding(
padding: const EdgeInsets.only(left: 20.0),
child: Text(
title,
style: TextStyle(
fontSize: 40,
fontWeight: FontWeight.w700,
color: Colors.white,
),
),
),
],
),
);
if (bottom != null) {
result = Column(
children: <Widget>[
result,
bottom,
],
);
}
return Material( return Material(
elevation: 10.0, elevation: 10.0,
child: Container( child: Container(
color: Theme.of(context).canvasColor, color: Theme.of(context).canvasColor,
child: SafeArea( child: SafeArea(
child: Container( child: result,
height: preferredSize.height,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
IconButton(
icon: Icon(
FontAwesomeIcons.arrowLeft,
color: Color.fromRGBO(112, 112, 112, 1),
),
onPressed: () => Navigator.of(context).pop(),
),
SizedBox(
height: 10,
),
Padding(
padding: const EdgeInsets.only(left: 20.0),
child: Text(
title,
style: TextStyle(
fontSize: 40,
fontWeight: FontWeight.w700,
color: Colors.white,
),
),
),
],
),
),
), ),
), ),
); );
} }
@override
final preferredSize = Size.fromHeight(140.0);
} }