diff --git a/lib/extensions/snackbar.dart b/lib/extensions/snackbar.dart index 66174db..26ad3ed 100644 --- a/lib/extensions/snackbar.dart +++ b/lib/extensions/snackbar.dart @@ -51,6 +51,16 @@ extension ShowSnackBar on BuildContext { ); } + void showLongErrorSnackBar({ + required final String message, + }) { + showSnackBar( + message: message, + backgroundColor: Colors.red, + duration: const Duration(seconds: 6), + ); + } + void showSuccessSnackBar({ required final String message, }) { diff --git a/lib/screens/login_screen.dart b/lib/screens/login_screen.dart index 129f90e..f768331 100644 --- a/lib/screens/login_screen.dart +++ b/lib/screens/login_screen.dart @@ -63,7 +63,7 @@ class _LoginScreenState extends AuthState with Loadable { await _signIn(); } catch (error) { if (mounted) { - context.showErrorSnackBar(message: error.toString()); + context.showLongErrorSnackBar(message: 'Invalid password or email'); emailController.clear(); passwordController.clear(); @@ -100,19 +100,26 @@ class _LoginScreenState extends AuthState with Loadable { 'Sign in to your account. If you do not have one already, we will automatically set up one for you.', ), const SizedBox(height: MEDIUM_SPACE), - TextFormField( + TextField( controller: emailController, autofocus: true, autofillHints: const [AutofillHints.email], - decoration: const InputDecoration(labelText: 'Email'), + keyboardType: TextInputType.emailAddress, + textInputAction: TextInputAction.next, + decoration: const InputDecoration( + labelText: 'Email', + prefixIcon: Icon(Icons.email), + ), ), const SizedBox(height: SMALL_SPACE), - TextFormField( + TextField( obscureText: true, controller: passwordController, decoration: const InputDecoration( labelText: 'Password', + prefixIcon: Icon(Icons.lock), ), + onSubmitted: (value) => callWithLoading(signIn), ), const SizedBox(height: MEDIUM_SPACE), ElevatedButton.icon( diff --git a/lib/screens/main_screen.dart b/lib/screens/main_screen.dart index a8f7f7a..e91ee59 100644 --- a/lib/screens/main_screen.dart +++ b/lib/screens/main_screen.dart @@ -121,6 +121,10 @@ class _MainScreenState extends AuthRequiredState with Loadable { await previousCameraController?.dispose(); + if (!mounted) { + return; + } + controller = cameraController; // Update UI if controller updates