李志伟 3 년 전
부모
커밋
c07d82ced0
1개의 변경된 파일44개의 추가작업 그리고 44개의 파일을 삭제
  1. 44
    44
      lib/pages/login/login.dart

+ 44
- 44
lib/pages/login/login.dart 파일 보기

10
 import '../../models/entities/person.dart';
10
 import '../../models/entities/person.dart';
11
 import '../../services/user.dart';
11
 import '../../services/user.dart';
12
 import '../../widgets/Cell.dart';
12
 import '../../widgets/Cell.dart';
13
+import '../home/index.dart';
13
 
14
 
14
 
15
 
15
 class MyRouteLogin extends StatefulWidget {
16
 class MyRouteLogin extends StatefulWidget {
19
 
20
 
20
 class _RouteLogin extends State<MyRouteLogin> {
21
 class _RouteLogin extends State<MyRouteLogin> {
21
 
22
 
22
-var  userInfo= AppController.t.user;
23
+  var  userInfo= AppController.t.user;
23
 
24
 
24
-bool isButtonEnable = true; //按钮状态  是否可点击
25
-String buttonText = '发送验证码'; //初始文本
26
-int count = 60; //初始倒计时时间
27
-var timer; //倒计时的计时器
28
-TextEditingController mController = TextEditingController();
25
+  bool isButtonEnable = true; //按钮状态  是否可点击
26
+  String buttonText = '发送验证码'; //初始文本
27
+  int count = 60; //初始倒计时时间
28
+  var timer; //倒计时的计时器
29
+  TextEditingController mController = TextEditingController();
29
 
30
 
30
 //获取验证码
31
 //获取验证码
31
-void _initTimer() {
32
-  timer = Timer.periodic(Duration(seconds: 1), (Timer timer) {
33
-    count--;
34
-    setState(() {
35
-      if (count == 0) {
36
-        timer.cancel(); //倒计时结束取消定时器
37
-        isButtonEnable = true; //按钮可点击
38
-        count = 60; //重置时间
39
-        buttonText = '发送验证码'; //重置按钮文本
40
-      } else {
41
-        buttonText = '重新发送($count)'; //更新文本内容
42
-      }
32
+  void _initTimer() {
33
+    timer = Timer.periodic(Duration(seconds: 1), (Timer timer) {
34
+      count--;
35
+      setState(() {
36
+        if (count == 0) {
37
+          timer.cancel(); //倒计时结束取消定时器
38
+          isButtonEnable = true; //按钮可点击
39
+          count = 60; //重置时间
40
+          buttonText = '发送验证码'; //重置按钮文本
41
+        } else {
42
+          buttonText = '重新发送($count)'; //更新文本内容
43
+        }
44
+      });
43
     });
45
     });
44
-  });
45
-}
46
+  }
46
 
47
 
47
 
48
 
48
 
49
 
75
 
76
 
76
 
77
 
77
   void _handlePhone(e) => {
78
   void _handlePhone(e) => {
78
-        setState(() => {handlePhones = e})
79
-      };
79
+    setState(() => {handlePhones = e})
80
+  };
80
 
81
 
81
   void _handleCode(e) => {
82
   void _handleCode(e) => {
82
-        setState(() => {handleCodes = e})
83
-      };
83
+    setState(() => {handleCodes = e})
84
+  };
84
 
85
 
85
 
86
 
86
 
87
 
106
       if(_newValue){
107
       if(_newValue){
107
         print('已同意协议');
108
         print('已同意协议');
108
         userLogin(handlePhones,handleCodes).then((value) {
109
         userLogin(handlePhones,handleCodes).then((value) {
109
-          userInfo(Person.fromJson(value.date.person));
110
-          Get.back();
111
-
110
+          userInfo(Person.fromJson(value['person']));
111
+          Get.off(Home());
112
         });
112
         });
113
       }else{
113
       }else{
114
         Fluttertoast.showToast(msg: '请阅读并同意相关隐私政策!');
114
         Fluttertoast.showToast(msg: '请阅读并同意相关隐私政策!');
122
       backgroundColor: Colors.transparent,
122
       backgroundColor: Colors.transparent,
123
       resizeToAvoidBottomInset: false,
123
       resizeToAvoidBottomInset: false,
124
       body: Container(
124
       body: Container(
125
-      decoration: const BoxDecoration(
126
-        image: DecorationImage(
127
-          image: AssetImage("images/icon_login.png"),
128
-          fit: BoxFit.cover,
125
+        decoration: const BoxDecoration(
126
+          image: DecorationImage(
127
+            image: AssetImage("images/icon_login.png"),
128
+            fit: BoxFit.cover,
129
+          ),
129
         ),
130
         ),
130
-      ),
131
 
131
 
132
-      child:  Container(
132
+        child:  Container(
133
           child: Column(
133
           child: Column(
134
             mainAxisAlignment: MainAxisAlignment.end,
134
             mainAxisAlignment: MainAxisAlignment.end,
135
             crossAxisAlignment: CrossAxisAlignment.start,
135
             crossAxisAlignment: CrossAxisAlignment.start,
149
                 ),
149
                 ),
150
               ),
150
               ),
151
               Cell(
151
               Cell(
152
-                  // margin: EdgeInsets.symmetric(horizontal: 13.w),
152
+                // margin: EdgeInsets.symmetric(horizontal: 13.w),
153
                   margin: const EdgeInsets.fromLTRB(13, 43, 10, 0),
153
                   margin: const EdgeInsets.fromLTRB(13, 43, 10, 0),
154
                   header: Text(
154
                   header: Text(
155
                     "+86",
155
                     "+86",
166
                     decoration: const InputDecoration(
166
                     decoration: const InputDecoration(
167
                       isCollapsed: true,
167
                       isCollapsed: true,
168
                       contentPadding:
168
                       contentPadding:
169
-                          EdgeInsets.symmetric(vertical: 8, horizontal: 16),
169
+                      EdgeInsets.symmetric(vertical: 8, horizontal: 16),
170
                       labelText: "请输入手机号码",
170
                       labelText: "请输入手机号码",
171
                       counterText: '', //去掉计数
171
                       counterText: '', //去掉计数
172
                       border: InputBorder.none,
172
                       border: InputBorder.none,
194
                         backgroundColor: isButtonEnable
194
                         backgroundColor: isButtonEnable
195
                             ? MaterialStateProperty.all(const Color(0xFFFF703B))
195
                             ? MaterialStateProperty.all(const Color(0xFFFF703B))
196
                             : MaterialStateProperty.all(
196
                             : MaterialStateProperty.all(
197
-                                const Color(0xFFCBCBCB)),
197
+                            const Color(0xFFCBCBCB)),
198
                         shape: MaterialStateProperty.all(
198
                         shape: MaterialStateProperty.all(
199
                             const RoundedRectangleBorder(
199
                             const RoundedRectangleBorder(
200
                                 borderRadius:
200
                                 borderRadius:
201
-                                    BorderRadius.all(Radius.circular(10)))),
201
+                                BorderRadius.all(Radius.circular(10)))),
202
                       ),
202
                       ),
203
                     ),
203
                     ),
204
                   )),
204
                   )),
223
                   decoration: const InputDecoration(
223
                   decoration: const InputDecoration(
224
                     isCollapsed: true,
224
                     isCollapsed: true,
225
                     contentPadding:
225
                     contentPadding:
226
-                        EdgeInsets.symmetric(vertical: 8, horizontal: 16),
226
+                    EdgeInsets.symmetric(vertical: 8, horizontal: 16),
227
                     labelText: "请输入验证码",
227
                     labelText: "请输入验证码",
228
                     border: InputBorder.none,
228
                     border: InputBorder.none,
229
                     floatingLabelBehavior: FloatingLabelBehavior.never,
229
                     floatingLabelBehavior: FloatingLabelBehavior.never,
254
                     style: ButtonStyle(
254
                     style: ButtonStyle(
255
                       elevation: MaterialStateProperty.all(0),
255
                       elevation: MaterialStateProperty.all(0),
256
                       backgroundColor:
256
                       backgroundColor:
257
-                          MaterialStateProperty.all(const Color(0xFFFF703B)),
257
+                      MaterialStateProperty.all(const Color(0xFFFF703B)),
258
                       shape: MaterialStateProperty.all(
258
                       shape: MaterialStateProperty.all(
259
                           const RoundedRectangleBorder(
259
                           const RoundedRectangleBorder(
260
                               borderRadius:
260
                               borderRadius:
261
-                                  BorderRadius.all(Radius.circular(24.4)))),
261
+                              BorderRadius.all(Radius.circular(24.4)))),
262
                     ),
262
                     ),
263
                   ),
263
                   ),
264
                 ),
264
                 ),
286
                             text: '文本协议/隐私政策,',
286
                             text: '文本协议/隐私政策,',
287
                             style: TextStyle(color: Color(0xffce3800)),
287
                             style: TextStyle(color: Color(0xffce3800)),
288
                             recognizer:
288
                             recognizer:
289
-                                TapGestureRecognizer() //踩坑。。。recognizer 是手势交互 除了我现在些的是 点击交互,其他一般都是抽象类。
290
-                                  ..onTap = () {
291
-                                    print('阅读已同意!!!');
292
-                                  },
289
+                            TapGestureRecognizer() //踩坑。。。recognizer 是手势交互 除了我现在些的是 点击交互,其他一般都是抽象类。
290
+                              ..onTap = () {
291
+                                print('阅读已同意!!!');
292
+                              },
293
                           ),
293
                           ),
294
                           const TextSpan(
294
                           const TextSpan(
295
                               text: '确认之后选择此项',
295
                               text: '确认之后选择此项',