Made the populated drawer in the events screen use the data from the firebase user object
This commit is contained in:
parent
57ffb7dd5c
commit
118bb26713
1 changed files with 33 additions and 9 deletions
|
|
@ -1,18 +1,42 @@
|
|||
import 'package:flutter/material.dart' hide AppBar;
|
||||
|
||||
import '../blocs/events_bloc.dart';
|
||||
import '../widgets/app_bar.dart';
|
||||
import '../widgets/populated_drawer.dart';
|
||||
|
||||
class EventsScreen extends StatelessWidget {
|
||||
class EventsScreen extends StatefulWidget {
|
||||
@override
|
||||
_EventsScreenState createState() => _EventsScreenState();
|
||||
}
|
||||
|
||||
class _EventsScreenState extends State<EventsScreen> {
|
||||
/// An instance of the bloc for this screen.
|
||||
final EventsBloc bloc = EventsBloc();
|
||||
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
drawer: PopulatedDrawer(
|
||||
selectedScreen: Screen.events,
|
||||
),
|
||||
appBar: AppBar(
|
||||
title: 'My Events',
|
||||
hasDrawer: true,
|
||||
),
|
||||
return StreamBuilder(
|
||||
stream: bloc.userStream,
|
||||
builder: (context, AsyncSnapshot<FirebaseUser> userSnap) {
|
||||
String userAvatarUrl, userDisplayName = '', userEmail = '';
|
||||
|
||||
if (userSnap.hasData) {
|
||||
userAvatarUrl = userSnap.data.photoUrl;
|
||||
userDisplayName = userSnap.data.displayName;
|
||||
userEmail = userSnap.data.email;
|
||||
}
|
||||
return Scaffold(
|
||||
drawer: PopulatedDrawer(
|
||||
userAvatarUrl: userAvatarUrl,
|
||||
userDisplayName: userDisplayName,
|
||||
userEmail: userEmail,
|
||||
selectedScreen: Screen.events,
|
||||
),
|
||||
appBar: AppBar(
|
||||
title: 'My Events',
|
||||
hasDrawer: true,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue