Browse Source

update(login): 实现回车登录 #0018063

gavin.chen 1 year ago
parent
commit
b225b8c9b1
1 changed files with 9 additions and 0 deletions
  1. 9 0
      lib/pages/login/view.dart

+ 9 - 0
lib/pages/login/view.dart

@@ -88,6 +88,9 @@ class LoginPage extends GetView<LoginController> {
                                 controller.passwordEditingController,
                             onChanged: (value) =>
                                 controller.state.password = value,
+                            onSubmit: () {
+                              controller.onSubmit();
+                            },
                           ),
                           const SizedBox(height: 20),
                           SizedBox(
@@ -265,6 +268,7 @@ class _PasswordInput extends StatefulWidget {
   final ValueChanged<String> onChanged;
   final bool isPasswordVisible;
   final TextEditingController textEditingController;
+  final VoidCallback onSubmit;
 
   const _PasswordInput({
     Key? key,
@@ -272,6 +276,7 @@ class _PasswordInput extends StatefulWidget {
     required this.onChanged,
     required this.isPasswordVisible,
     required this.textEditingController,
+    required this.onSubmit,
   }) : super(key: key);
 
   @override
@@ -319,6 +324,10 @@ class _PasswordInputState extends State<_PasswordInput> {
         onChanged: (value) {
           widget.onChanged(value);
         },
+        onSubmitted: (value) {
+          print("submit");
+          widget.onSubmit();
+        },
         style: const TextStyle(fontSize: 20),
         decoration: InputDecoration(
           fillColor: Colors.white,