Multiple improvements in authentication functionality
This commit is contained in:
1 parent
bd5c4e002f
commit
fbee31841d
11 files changed
+260
-17
No files matched your search
@@ -8,6 +8,13 @@ class LoginScreen extends StatelessWidget {
|
||||
final TextEditingController usernameController = TextEditingController();
|
||||
final TextEditingController passwordController = TextEditingController();
|
||||
|
||||
final FocusNode usernameFocusNode = FocusNode();
|
||||
final FocusNode passwordFocusNode = FocusNode();
|
||||
|
||||
void _handleLogin() {
|
||||
onLogin(usernameController.text, passwordController.text);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -18,18 +25,29 @@ class LoginScreen extends StatelessWidget {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
TextField(controller: usernameController, decoration: InputDecoration(labelText: 'Username')),
|
||||
TextField(
|
||||
controller: usernameController,
|
||||
focusNode: usernameFocusNode,
|
||||
decoration: InputDecoration(labelText: 'Username'),
|
||||
textInputAction: TextInputAction.next,
|
||||
onSubmitted: (_) {
|
||||
FocusScope.of(context).requestFocus(passwordFocusNode);
|
||||
},
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
TextField(
|
||||
controller: passwordController,
|
||||
focusNode: passwordFocusNode,
|
||||
decoration: InputDecoration(labelText: 'Password'),
|
||||
obscureText: true, // Hide password characters
|
||||
obscureText: true,
|
||||
textInputAction: TextInputAction.done,
|
||||
onSubmitted: (_) {
|
||||
_handleLogin();
|
||||
},
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
onLogin(usernameController.text, passwordController.text);
|
||||
},
|
||||
onPressed: _handleLogin,
|
||||
child: Text('Login'),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user