mirror of
https://github.com/Myzel394/quid_faciam_hodie.git
synced 2025-06-19 15:45:26 +02:00
improvements
This commit is contained in:
parent
f7b1c51d09
commit
ae1a5c8b07
@ -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({
|
void showSuccessSnackBar({
|
||||||
required final String message,
|
required final String message,
|
||||||
}) {
|
}) {
|
||||||
|
@ -63,7 +63,7 @@ class _LoginScreenState extends AuthState<LoginScreen> with Loadable {
|
|||||||
await _signIn();
|
await _signIn();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
context.showErrorSnackBar(message: error.toString());
|
context.showLongErrorSnackBar(message: 'Invalid password or email');
|
||||||
|
|
||||||
emailController.clear();
|
emailController.clear();
|
||||||
passwordController.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.',
|
'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),
|
const SizedBox(height: MEDIUM_SPACE),
|
||||||
TextFormField(
|
TextField(
|
||||||
controller: emailController,
|
controller: emailController,
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
autofillHints: const [AutofillHints.email],
|
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),
|
const SizedBox(height: SMALL_SPACE),
|
||||||
TextFormField(
|
TextField(
|
||||||
obscureText: true,
|
obscureText: true,
|
||||||
controller: passwordController,
|
controller: passwordController,
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
labelText: 'Password',
|
labelText: 'Password',
|
||||||
|
prefixIcon: Icon(Icons.lock),
|
||||||
),
|
),
|
||||||
|
onSubmitted: (value) => callWithLoading(signIn),
|
||||||
),
|
),
|
||||||
const SizedBox(height: MEDIUM_SPACE),
|
const SizedBox(height: MEDIUM_SPACE),
|
||||||
ElevatedButton.icon(
|
ElevatedButton.icon(
|
||||||
|
@ -121,6 +121,10 @@ class _MainScreenState extends AuthRequiredState<MainScreen> with Loadable {
|
|||||||
|
|
||||||
await previousCameraController?.dispose();
|
await previousCameraController?.dispose();
|
||||||
|
|
||||||
|
if (!mounted) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
controller = cameraController;
|
controller = cameraController;
|
||||||
|
|
||||||
// Update UI if controller updates
|
// Update UI if controller updates
|
||||||
|
Loading…
x
Reference in New Issue
Block a user