login debug

This commit is contained in:
mr
2024-11-27 10:54:10 +01:00
parent e73ca6b532
commit 2c86e90b76
3 changed files with 15 additions and 12 deletions

View File

@@ -18,24 +18,23 @@ class LoginWidgetState extends State<LoginWidget> {
FocusNode focusNode = FocusNode();
@override Widget build(BuildContext context) {
return KeyboardListener(focusNode: focusNode,
onKeyEvent: (value) {
onKeyEvent: (value) async {
if (value is KeyDownEvent && value.logicalKey == LogicalKeyboardKey.enter) {
if (usernameCtrl.text == "" || passwordCtrl.text == "") { return; }
error = null;
setState(() {
loading = true;
});
AuthService.login(usernameCtrl.text, passwordCtrl.text).catchError( (e) {
await AuthService.login(usernameCtrl.text, passwordCtrl.text).catchError( (e) {
setState(() {
loading = false;
error = "Invalid username or password";
});
});
if (error == null) {
// ignore: use_build_context_synchronously
setState(() {
loading = true;
loading = false;
});
context.pop();
}
@@ -114,6 +113,7 @@ class LoginWidgetState extends State<LoginWidget> {
loading = true;
});
context.pop();
//mainKey?.currentState!.setState(() {});
}
},
mouseCursor: SystemMouseCursors.click,