login debug
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user