From b64f80e27b839caf651650c4e2b5543661cb8649 Mon Sep 17 00:00:00 2001 From: Jared Hasson Date: Thu, 10 Oct 2019 19:14:14 -0600 Subject: [PATCH] Added failedLogin alert dialog --- lib/screens/login_screen.dart | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/lib/screens/login_screen.dart b/lib/screens/login_screen.dart index 99130de..a0f914d 100644 --- a/lib/screens/login_screen.dart +++ b/lib/screens/login_screen.dart @@ -132,8 +132,13 @@ class _LoginScreenState extends State { ), RaisedButton( onPressed: () { + bool failedLogin = true; final AuthBloc authBloc = BlocProvider.of(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), @@ -165,4 +170,31 @@ class _LoginScreenState extends State { ), ); } + + Future showFailedLoginDialog() { + return showDialog( + context: context, + barrierDismissible: false, // user must tap button! + builder: (BuildContext context) { + return AlertDialog( + title: Text("Unsuccessful Login"), + content: SingleChildScrollView( + child: ListBody( + children: [ + Text("We're sorry, \nyour login was not successful.\nPlease try again."), + ], + ), + ), + actions: [ + FlatButton( + child: Text('OK'), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ); + }, + ); + } }