feat: add profile screen and update routing; enhance login validation and logout functionality

This commit is contained in:
Nils-Johan Gynther
2026-04-21 22:30:35 +02:00
parent fa06ba0915
commit 056d5a8a1b
7 changed files with 240 additions and 1 deletions
@@ -22,6 +22,9 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
}
Future<void> _submit() async {
if (_usernameCtrl.text.trim().isEmpty || _passwordCtrl.text.isEmpty) {
return;
}
await ref.read(authStateProvider.notifier).login(
_usernameCtrl.text.trim(),
_passwordCtrl.text,
@@ -47,12 +50,15 @@ class _LoginScreenState extends ConsumerState<LoginScreen> {
TextField(
controller: _usernameCtrl,
decoration: const InputDecoration(labelText: 'Anvandarnamn'),
textInputAction: TextInputAction.next,
),
const SizedBox(height: 12),
TextField(
controller: _passwordCtrl,
decoration: const InputDecoration(labelText: 'Lösenord'),
obscureText: true,
textInputAction: TextInputAction.done,
onSubmitted: (_) => _submit(),
),
const SizedBox(height: 24),
if (authState is AsyncLoading)