improvements

This commit is contained in:
Myzel394 2022-08-16 20:26:22 +02:00
parent f7b1c51d09
commit ae1a5c8b07
3 changed files with 25 additions and 4 deletions

View File

@ -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,
}) {

View File

@ -63,7 +63,7 @@ class _LoginScreenState extends AuthState<LoginScreen> 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<LoginScreen> 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(

View File

@ -121,6 +121,10 @@ class _MainScreenState extends AuthRequiredState<MainScreen> with Loadable {
await previousCameraController?.dispose();
if (!mounted) {
return;
}
controller = cameraController;
// Update UI if controller updates