add submit

This commit is contained in:
2026-04-13 11:01:50 +02:00
parent 8f2086e3a3
commit 97604a81e5
3 changed files with 40 additions and 28 deletions

View File

@@ -84,6 +84,7 @@ class _AuthScreenState extends State<AuthScreen> {
icon: Icons.lock_outline,
isPassword: true,
controller: _passwordController,
onSubmitted: (_) => _submit(),
),
const SizedBox(height: 40),
@@ -93,16 +94,7 @@ class _AuthScreenState extends State<AuthScreen> {
width: double.infinity,
height: 56,
child: ElevatedButton(
onPressed: isLoading
? null
: () {
context.read<AuthBloc>().add(
LoginRequested(
email: _emailController.text.trim(),
password: _passwordController.text.trim(),
),
);
},
onPressed: isLoading ? null : () => _submit(),
child: isLoading
? const SizedBox(
height: 24,
@@ -151,4 +143,13 @@ class _AuthScreenState extends State<AuthScreen> {
),
);
}
void _submit() {
context.read<AuthBloc>().add(
LoginRequested(
email: _emailController.text.trim(),
password: _passwordController.text.trim(),
),
);
}
}