Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions lib/screens/login_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,13 @@ class _LoginScreenState extends State<LoginScreen> {
),
RaisedButton(
onPressed: () {
bool failedLogin = true;
final AuthBloc authBloc = BlocProvider.of<AuthBloc>(context);
authBloc.dispatch(Login(email: email, password: password));
// TODO(hasnayeen): set failedLogin based on results of authBloc login
if (failedLogin){
showFailedLoginDialog();
}
},
color: Colors.teal,
padding: const EdgeInsets.fromLTRB(15, 10, 15, 10),
Expand Down Expand Up @@ -165,4 +170,31 @@ class _LoginScreenState extends State<LoginScreen> {
),
);
}

Future<void> showFailedLoginDialog() {
return showDialog<void>(
context: context,
barrierDismissible: false, // user must tap button!
builder: (BuildContext context) {
return AlertDialog(
title: Text("Unsuccessful Login"),
content: SingleChildScrollView(
child: ListBody(
children: <Widget>[
Text("We're sorry, \nyour login was not successful.\nPlease try again."),
],
),
),
actions: <Widget>[
FlatButton(
child: Text('OK'),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
},
);
}
}