feat: add profile screen and update routing; enhance login validation and logout functionality
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user