|
@@ -12,15 +12,13 @@ import '../../models/entities/person.dart';
|
12
|
12
|
import '../../services/user.dart';
|
13
|
13
|
import '../../widgets/Cell.dart';
|
14
|
14
|
|
15
|
|
-
|
16
|
15
|
class MyRouteLogin extends StatefulWidget {
|
17
|
16
|
@override
|
18
|
17
|
State<MyRouteLogin> createState() => _RouteLogin();
|
19
|
18
|
}
|
20
|
19
|
|
21
|
20
|
class _RouteLogin extends State<MyRouteLogin> {
|
22
|
|
-
|
23
|
|
- var userInfo= AppController.t.user;
|
|
21
|
+ var userInfo = AppController.t.user;
|
24
|
22
|
|
25
|
23
|
bool isButtonEnable = true;
|
26
|
24
|
String buttonText = '发送验证码';
|
|
@@ -28,7 +26,7 @@ class _RouteLogin extends State<MyRouteLogin> {
|
28
|
26
|
var timer;
|
29
|
27
|
TextEditingController mController = TextEditingController();
|
30
|
28
|
|
31
|
|
-
|
|
29
|
+
|
32
|
30
|
void _initTimer() {
|
33
|
31
|
timer = Timer.periodic(Duration(seconds: 1), (Timer timer) {
|
34
|
32
|
count--;
|
|
@@ -45,9 +43,6 @@ class _RouteLogin extends State<MyRouteLogin> {
|
45
|
43
|
});
|
46
|
44
|
}
|
47
|
45
|
|
48
|
|
-
|
49
|
|
-
|
50
|
|
-
|
51
|
46
|
@override
|
52
|
47
|
void initState() {
|
53
|
48
|
super.initState();
|
|
@@ -68,24 +63,21 @@ class _RouteLogin extends State<MyRouteLogin> {
|
68
|
63
|
|
69
|
64
|
}
|
70
|
65
|
|
71
|
|
-
|
|
66
|
+
|
72
|
67
|
var handlePhones = '';
|
73
|
68
|
var handleCodes = '';
|
74
|
69
|
var userContent = {'phones': '', 'code': ''};
|
75
|
70
|
bool _newValue = false;
|
76
|
71
|
|
77
|
|
-
|
78
|
72
|
void _handlePhone(e) => {
|
79
|
|
- setState(() => {handlePhones = e})
|
80
|
|
- };
|
|
73
|
+ setState(() => {handlePhones = e})
|
|
74
|
+ };
|
81
|
75
|
|
82
|
76
|
void _handleCode(e) => {
|
83
|
|
- setState(() => {handleCodes = e})
|
84
|
|
- };
|
85
|
|
-
|
|
77
|
+ setState(() => {handleCodes = e})
|
|
78
|
+ };
|
86
|
79
|
|
87
|
|
-
|
88
|
|
-
|
|
80
|
+
|
89
|
81
|
void _buttonClickListen() {
|
90
|
82
|
setState(() {
|
91
|
83
|
if (isButtonEnable) {
|
|
@@ -99,19 +91,20 @@ class _RouteLogin extends State<MyRouteLogin> {
|
99
|
91
|
}
|
100
|
92
|
});
|
101
|
93
|
}
|
102
|
|
-
|
103
|
|
- void _handelSubmit(){
|
104
|
|
- if(handleCodes==''||handlePhones==''){
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+ void _handelSubmit() {
|
|
97
|
+ if (handleCodes == '' || handlePhones == '') {
|
105
|
98
|
Fluttertoast.showToast(msg: '请输入验证码或手机号!');
|
106
|
|
- }else{
|
107
|
|
- if(_newValue){
|
108
|
|
- userLogin(handlePhones,handleCodes).then((value) {
|
|
99
|
+ } else {
|
|
100
|
+ if (_newValue) {
|
|
101
|
+ userLogin(handlePhones, handleCodes).then((value) {
|
109
|
102
|
userInfo(Person.fromJson(value['person']));
|
110
|
103
|
print('已同意协议');
|
111
|
104
|
|
112
|
105
|
Get.off(Home());
|
113
|
106
|
});
|
114
|
|
- }else{
|
|
107
|
+ } else {
|
115
|
108
|
Fluttertoast.showToast(msg: '请阅读并同意相关隐私政策!');
|
116
|
109
|
}
|
117
|
110
|
}
|
|
@@ -129,23 +122,24 @@ class _RouteLogin extends State<MyRouteLogin> {
|
129
|
122
|
fit: BoxFit.cover,
|
130
|
123
|
),
|
131
|
124
|
),
|
132
|
|
-
|
133
|
|
- child: Container(
|
|
125
|
+ child: Container(
|
134
|
126
|
child: Column(
|
135
|
127
|
mainAxisAlignment: MainAxisAlignment.end,
|
136
|
128
|
crossAxisAlignment: CrossAxisAlignment.start,
|
137
|
|
- children:[
|
138
|
|
- Padding(padding: EdgeInsets.fromLTRB(15, 0, 0, 5),
|
139
|
|
- child: const Text(
|
140
|
|
- '您好!',
|
141
|
|
- style: TextStyle(
|
142
|
|
- fontWeight: FontWeight.bold,
|
143
|
|
- fontSize: 33,
|
|
129
|
+ children: [
|
|
130
|
+ Padding(
|
|
131
|
+ padding: EdgeInsets.fromLTRB(15, 0, 0, 5),
|
|
132
|
+ child: const Text(
|
|
133
|
+ '您好!',
|
|
134
|
+ style: TextStyle(
|
|
135
|
+ fontWeight: FontWeight.bold,
|
|
136
|
+ fontSize: 33,
|
|
137
|
+ ),
|
144
|
138
|
),
|
145
|
139
|
),
|
146
|
|
- ),
|
147
|
|
- Padding(padding: EdgeInsets.fromLTRB(15, 0, 0, 0),
|
148
|
|
- child: const Text(
|
|
140
|
+ Padding(
|
|
141
|
+ padding: EdgeInsets.fromLTRB(15, 0, 0, 0),
|
|
142
|
+ child: const Text(
|
149
|
143
|
'欢迎进入农户端应用!',
|
150
|
144
|
style: TextStyle(
|
151
|
145
|
fontWeight: FontWeight.bold,
|
|
@@ -153,9 +147,8 @@ class _RouteLogin extends State<MyRouteLogin> {
|
153
|
147
|
),
|
154
|
148
|
),
|
155
|
149
|
),
|
156
|
|
-
|
157
|
150
|
Cell(
|
158
|
|
-
|
|
151
|
+
|
159
|
152
|
margin: const EdgeInsets.fromLTRB(13, 43, 10, 0),
|
160
|
153
|
header: Text(
|
161
|
154
|
"+86",
|
|
@@ -172,7 +165,7 @@ class _RouteLogin extends State<MyRouteLogin> {
|
172
|
165
|
decoration: const InputDecoration(
|
173
|
166
|
isCollapsed: true,
|
174
|
167
|
contentPadding:
|
175
|
|
- EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
|
168
|
+ EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
176
|
169
|
labelText: "请输入手机号码",
|
177
|
170
|
counterText: '',
|
178
|
171
|
border: InputBorder.none,
|
|
@@ -199,11 +192,11 @@ class _RouteLogin extends State<MyRouteLogin> {
|
199
|
192
|
backgroundColor: isButtonEnable
|
200
|
193
|
? MaterialStateProperty.all(const Color(0xFFFF703B))
|
201
|
194
|
: MaterialStateProperty.all(
|
202
|
|
- const Color(0xFFCBCBCB)),
|
|
195
|
+ const Color(0xFFCBCBCB)),
|
203
|
196
|
shape: MaterialStateProperty.all(
|
204
|
197
|
const RoundedRectangleBorder(
|
205
|
198
|
borderRadius:
|
206
|
|
- BorderRadius.all(Radius.circular(10)))),
|
|
199
|
+ BorderRadius.all(Radius.circular(10)))),
|
207
|
200
|
),
|
208
|
201
|
),
|
209
|
202
|
)),
|
|
@@ -228,7 +221,7 @@ class _RouteLogin extends State<MyRouteLogin> {
|
228
|
221
|
decoration: const InputDecoration(
|
229
|
222
|
isCollapsed: true,
|
230
|
223
|
contentPadding:
|
231
|
|
- EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
|
224
|
+ EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
232
|
225
|
labelText: "请输入验证码",
|
233
|
226
|
border: InputBorder.none,
|
234
|
227
|
floatingLabelBehavior: FloatingLabelBehavior.never,
|
|
@@ -238,7 +231,6 @@ class _RouteLogin extends State<MyRouteLogin> {
|
238
|
231
|
},
|
239
|
232
|
),
|
240
|
233
|
),
|
241
|
|
-
|
242
|
234
|
Container(
|
243
|
235
|
height: 350.h,
|
244
|
236
|
alignment: Alignment.bottomCenter,
|
|
@@ -259,16 +251,15 @@ class _RouteLogin extends State<MyRouteLogin> {
|
259
|
251
|
style: ButtonStyle(
|
260
|
252
|
elevation: MaterialStateProperty.all(0),
|
261
|
253
|
backgroundColor:
|
262
|
|
- MaterialStateProperty.all(const Color(0xFFFF703B)),
|
|
254
|
+ MaterialStateProperty.all(const Color(0xFFFF703B)),
|
263
|
255
|
shape: MaterialStateProperty.all(
|
264
|
256
|
const RoundedRectangleBorder(
|
265
|
257
|
borderRadius:
|
266
|
|
- BorderRadius.all(Radius.circular(24.4)))),
|
|
258
|
+ BorderRadius.all(Radius.circular(24.4)))),
|
267
|
259
|
),
|
268
|
260
|
),
|
269
|
261
|
),
|
270
|
262
|
),
|
271
|
|
-
|
272
|
263
|
Container(
|
273
|
264
|
padding: EdgeInsets.fromLTRB(10.0, 10, 10.0, 10),
|
274
|
265
|
child: Row(
|
|
@@ -291,10 +282,10 @@ class _RouteLogin extends State<MyRouteLogin> {
|
291
|
282
|
text: '文本协议/隐私政策,',
|
292
|
283
|
style: TextStyle(color: Color(0xffce3800)),
|
293
|
284
|
recognizer:
|
294
|
|
- TapGestureRecognizer()
|
295
|
|
- ..onTap = () {
|
296
|
|
- Get.toNamed('/agreement');
|
297
|
|
- },
|
|
285
|
+ TapGestureRecognizer()
|
|
286
|
+ ..onTap = () {
|
|
287
|
+ Get.toNamed('/agreement');
|
|
288
|
+ },
|
298
|
289
|
),
|
299
|
290
|
const TextSpan(
|
300
|
291
|
text: '确认之后选择此项',
|