|
@@ -1,12 +1,10 @@
|
1
|
|
-
|
2
|
|
-
|
3
|
1
|
import 'dart:async';
|
4
|
2
|
|
5
|
3
|
import 'package:farmer_client/components/UI/DefaultButton.dart';
|
6
|
4
|
import 'package:flutter/material.dart';
|
7
|
5
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
8
|
6
|
|
9
|
|
-
|
|
7
|
+import '../../widgets/Cell.dart';
|
10
|
8
|
|
11
|
9
|
class MyRouteLogin extends StatefulWidget {
|
12
|
10
|
@override
|
|
@@ -64,22 +62,22 @@ class _RouteLogin extends State<MyRouteLogin> {
|
64
|
62
|
var handleCodes = '';
|
65
|
63
|
|
66
|
64
|
void _handlePhone(e) => {
|
67
|
|
- setState(() => {handlePhones = e})
|
68
|
|
- };
|
|
65
|
+ setState(() => {handlePhones = e})
|
|
66
|
+ };
|
69
|
67
|
|
70
|
68
|
void _handleCode(e) => {
|
71
|
|
- setState(() => {handleCodes = e})
|
72
|
|
- };
|
|
69
|
+ setState(() => {handleCodes = e})
|
|
70
|
+ };
|
73
|
71
|
|
74
|
72
|
var userContent = {'phones': '', 'code': ''};
|
75
|
73
|
|
76
|
74
|
void phoneUser() => {
|
77
|
|
- setState(() {
|
78
|
|
- userContent['phones'] = handlePhones;
|
79
|
|
- userContent['code'] = handleCodes;
|
80
|
|
- }),
|
81
|
|
- print('我输入的信息:${userContent},手机号:${userContent['phones']}')
|
82
|
|
- };
|
|
75
|
+ setState(() {
|
|
76
|
+ userContent['phones'] = handlePhones;
|
|
77
|
+ userContent['code'] = handleCodes;
|
|
78
|
+ }),
|
|
79
|
+ print('我输入的信息:${userContent},手机号:${userContent['phones']}')
|
|
80
|
+ };
|
83
|
81
|
|
84
|
82
|
@override
|
85
|
83
|
Widget build(BuildContext context) {
|
|
@@ -100,124 +98,168 @@ class _RouteLogin extends State<MyRouteLogin> {
|
100
|
98
|
),
|
101
|
99
|
body: Center(
|
102
|
100
|
child: Column(
|
103
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
104
|
|
- children: <Widget>[
|
105
|
|
- Text(
|
106
|
|
- '您好!',
|
107
|
|
- style: TextStyle(
|
108
|
|
- fontWeight: FontWeight.bold,
|
109
|
|
- fontSize: 50,
|
110
|
|
- ),
|
111
|
|
- ),
|
112
|
|
- Text(
|
113
|
|
- '欢迎进入农户端应用!',
|
|
101
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
102
|
+ children: <Widget>[
|
|
103
|
+ Text(
|
|
104
|
+ '您好!',
|
|
105
|
+ style: TextStyle(
|
|
106
|
+ fontWeight: FontWeight.bold,
|
|
107
|
+ fontSize: 50,
|
|
108
|
+ ),
|
|
109
|
+ ),
|
|
110
|
+ Text(
|
|
111
|
+ '欢迎进入农户端应用!',
|
|
112
|
+ style: TextStyle(
|
|
113
|
+ fontWeight: FontWeight.bold,
|
|
114
|
+ fontSize: 35,
|
|
115
|
+ ),
|
|
116
|
+ ),
|
|
117
|
+
|
|
118
|
+ // Container(
|
|
119
|
+ // // margin: EdgeInsets.fromLTRB(5,0,0,0),
|
|
120
|
+ // decoration: BoxDecoration(
|
|
121
|
+ // border: Border(
|
|
122
|
+ // bottom: BorderSide(
|
|
123
|
+ // width: 1, color: Color(0xffe5e5e5)))),
|
|
124
|
+ // child: Flex(
|
|
125
|
+ // direction: Axis.horizontal,
|
|
126
|
+ // children: <Widget>[
|
|
127
|
+ // Expanded(
|
|
128
|
+ // child: TextField(
|
|
129
|
+ // autofocus: true,
|
|
130
|
+ // maxLength: 11,
|
|
131
|
+ // keyboardType: TextInputType.number,
|
|
132
|
+ // cursorColor: Color(0xD4D4D4FF),
|
|
133
|
+ // decoration: const InputDecoration(
|
|
134
|
+ // contentPadding:EdgeInsets.fromLTRB(30.0, 0, 0, 0),
|
|
135
|
+ // hintText: "请输入手机号",
|
|
136
|
+ // prefixIcon: Icon(Icons.phone_iphone_outlined),
|
|
137
|
+ // counterText: '',
|
|
138
|
+ // border: OutlineInputBorder(
|
|
139
|
+ // borderSide: BorderSide.none),
|
|
140
|
+ // ),
|
|
141
|
+ // onChanged: (e) {
|
|
142
|
+ // _handlePhone(e);
|
|
143
|
+ // // phoneUser(e);
|
|
144
|
+ // },
|
|
145
|
+ // ),
|
|
146
|
+ // ),
|
|
147
|
+ // Container(
|
|
148
|
+ // width: 100.0,
|
|
149
|
+ // child: SizedBox(
|
|
150
|
+ // child: FlatButton(
|
|
151
|
+ // disabledColor:
|
|
152
|
+ // Colors.grey.withOpacity(0.1), //按钮禁用时的颜色
|
|
153
|
+ // disabledTextColor: Colors.white, //按钮禁用时的文本颜色
|
|
154
|
+ // textColor: isButtonEnable
|
|
155
|
+ // ? Colors.white
|
|
156
|
+ // : Colors.black.withOpacity(0.2), //文本颜色
|
|
157
|
+ // color: isButtonEnable
|
|
158
|
+ // ? Color(0xffff703b)
|
|
159
|
+ // : Colors.grey.withOpacity(0.1), //按钮的颜色
|
|
160
|
+ // splashColor: isButtonEnable
|
|
161
|
+ // ? Colors.white.withOpacity(0.1)
|
|
162
|
+ // : Colors.transparent,
|
|
163
|
+ // shape: StadiumBorder(side: BorderSide.none),
|
|
164
|
+ // onPressed: () {
|
|
165
|
+ // setState(() {
|
|
166
|
+ // if (isButtonEnable) {
|
|
167
|
+ // _buttonClickListen();
|
|
168
|
+ // } else {
|
|
169
|
+ // return;
|
|
170
|
+ // }
|
|
171
|
+ // });
|
|
172
|
+ // },
|
|
173
|
+ // child: Text(
|
|
174
|
+ // '$buttonText',
|
|
175
|
+ // style: TextStyle(
|
|
176
|
+ // fontSize: 13,
|
|
177
|
+ //
|
|
178
|
+ // ),
|
|
179
|
+ // ),
|
|
180
|
+ // ),
|
|
181
|
+ // ),
|
|
182
|
+ // ),
|
|
183
|
+ // ],
|
|
184
|
+ // )),
|
|
185
|
+
|
|
186
|
+ Cell(
|
|
187
|
+ margin: EdgeInsets.symmetric(horizontal: 13.w),
|
|
188
|
+ header: Text(
|
|
189
|
+ "+86",
|
|
190
|
+ style: TextStyle(fontSize: 19.sp),
|
|
191
|
+ ),
|
|
192
|
+ child: TextField(
|
114
|
193
|
style: TextStyle(
|
115
|
|
- fontWeight: FontWeight.bold,
|
116
|
|
- fontSize: 35,
|
|
194
|
+ fontSize: 17.sp,
|
117
|
195
|
),
|
118
|
|
- ),
|
119
|
|
-
|
120
|
|
- Container(
|
121
|
|
- // margin: EdgeInsets.fromLTRB(5,0,0,0),
|
122
|
|
- decoration: BoxDecoration(
|
123
|
|
- border: Border(
|
124
|
|
- bottom: BorderSide(
|
125
|
|
- width: 1, color: Color(0xffe5e5e5)))),
|
126
|
|
- child: Flex(
|
127
|
|
- direction: Axis.horizontal,
|
128
|
|
- children: <Widget>[
|
129
|
|
- Expanded(
|
130
|
|
- child: TextField(
|
131
|
|
- autofocus: true,
|
132
|
|
- maxLength: 11,
|
133
|
|
- keyboardType: TextInputType.number,
|
134
|
|
- cursorColor: Color(0xD4D4D4FF),
|
135
|
|
- decoration: const InputDecoration(
|
136
|
|
- contentPadding:EdgeInsets.fromLTRB(30.0, 0, 0, 0),
|
137
|
|
- hintText: "请输入手机号",
|
138
|
|
- prefixIcon: Icon(Icons.phone_iphone_outlined),
|
139
|
|
- counterText: '',
|
140
|
|
- border: OutlineInputBorder(
|
141
|
|
- borderSide: BorderSide.none),
|
142
|
|
- ),
|
143
|
|
- onChanged: (e) {
|
144
|
|
- _handlePhone(e);
|
145
|
|
- // phoneUser(e);
|
146
|
|
- },
|
147
|
|
- ),
|
148
|
|
- ),
|
149
|
|
- Container(
|
150
|
|
- width: 100.0,
|
151
|
|
- child: SizedBox(
|
152
|
|
- child: FlatButton(
|
153
|
|
- disabledColor:
|
154
|
|
- Colors.grey.withOpacity(0.1), //按钮禁用时的颜色
|
155
|
|
- disabledTextColor: Colors.white, //按钮禁用时的文本颜色
|
156
|
|
- textColor: isButtonEnable
|
157
|
|
- ? Colors.white
|
158
|
|
- : Colors.black.withOpacity(0.2), //文本颜色
|
159
|
|
- color: isButtonEnable
|
160
|
|
- ? Color(0xffff703b)
|
161
|
|
- : Colors.grey.withOpacity(0.1), //按钮的颜色
|
162
|
|
- splashColor: isButtonEnable
|
163
|
|
- ? Colors.white.withOpacity(0.1)
|
164
|
|
- : Colors.transparent,
|
165
|
|
- shape: StadiumBorder(side: BorderSide.none),
|
166
|
|
- onPressed: () {
|
167
|
|
- setState(() {
|
168
|
|
- if (isButtonEnable) {
|
169
|
|
- _buttonClickListen();
|
170
|
|
- } else {
|
171
|
|
- return;
|
172
|
|
- }
|
173
|
|
- });
|
174
|
|
- },
|
175
|
|
- child: Text(
|
176
|
|
- '$buttonText',
|
177
|
|
- style: TextStyle(
|
178
|
|
- fontSize: 13,
|
179
|
|
-
|
180
|
|
- ),
|
181
|
|
- ),
|
182
|
|
- ),
|
183
|
|
- ),
|
184
|
|
- ),
|
185
|
|
- ],
|
186
|
|
- )),
|
187
|
|
-
|
188
|
|
- TextField(
|
189
|
|
- keyboardType: TextInputType.number,
|
190
|
|
- cursorColor: Color(0xD4D4D4FF),
|
191
|
196
|
decoration: const InputDecoration(
|
192
|
|
- hintText: "请输入验证码",
|
193
|
|
- prefixIcon: Icon(Icons.beenhere)),
|
194
|
|
- onChanged: (e) {
|
195
|
|
- _handleCode(e);
|
196
|
|
- },
|
|
197
|
+ isCollapsed: true,
|
|
198
|
+ contentPadding:
|
|
199
|
+ EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
|
200
|
+ labelText: "请输入手机号码",
|
|
201
|
+ border: InputBorder.none,
|
|
202
|
+ // border: OutlineInputBorder(
|
|
203
|
+ // // borderSide: BorderSide.none,
|
|
204
|
+ // // gapPadding: 0,
|
|
205
|
+ // ),
|
|
206
|
+ floatingLabelBehavior: FloatingLabelBehavior.never,
|
|
207
|
+ )),
|
|
208
|
+ footer: ElevatedButton(
|
|
209
|
+ onPressed: () => {
|
|
210
|
+ setState(() {
|
|
211
|
+ if (isButtonEnable) {
|
|
212
|
+ _buttonClickListen();
|
|
213
|
+ } else {
|
|
214
|
+ return;
|
|
215
|
+ }
|
|
216
|
+ })
|
|
217
|
+ },
|
|
218
|
+ child: Text(
|
|
219
|
+ '$buttonText',
|
|
220
|
+ style: TextStyle(fontSize: 15.sp),
|
197
|
221
|
),
|
198
|
|
- // 登录按钮
|
|
222
|
+ style: ElevatedButton.styleFrom(
|
|
223
|
+ primary: const Color(0xFFFF703B),
|
|
224
|
+ elevation: 0,
|
|
225
|
+ shape: const RoundedRectangleBorder(
|
|
226
|
+ borderRadius:
|
|
227
|
+ BorderRadius.all(Radius.circular(10)))),
|
|
228
|
+ ),
|
|
229
|
+ ),
|
|
230
|
+
|
|
231
|
+ TextField(
|
|
232
|
+ keyboardType: TextInputType.number,
|
|
233
|
+ cursorColor: Color(0xD4D4D4FF),
|
|
234
|
+ decoration: const InputDecoration(
|
|
235
|
+ hintText: "请输入验证码", prefixIcon: Icon(Icons.beenhere)),
|
|
236
|
+ onChanged: (e) {
|
|
237
|
+ _handleCode(e);
|
|
238
|
+ },
|
|
239
|
+ ),
|
|
240
|
+ // 登录按钮
|
199
|
241
|
|
200
|
|
- Container(
|
201
|
|
- child: DefaultButton(
|
202
|
|
- margin:
|
|
242
|
+ Container(
|
|
243
|
+ child: DefaultButton(
|
|
244
|
+ margin:
|
203
|
245
|
EdgeInsets.fromLTRB(0, 30.0, 0, 0), //可选配置,自定义控件中有默认配置
|
204
|
|
- text: "登陆",
|
205
|
|
- width: 200.0,
|
206
|
|
- height: 50.0,
|
207
|
|
- fontSize: 20.0,
|
208
|
|
- backColor: Color(0xffff703b),
|
209
|
|
- color: Colors.white,
|
210
|
|
- onPressed: () {
|
211
|
|
- Navigator.push(
|
212
|
|
- context,
|
213
|
|
- MaterialPageRoute(builder: (context) {
|
214
|
|
- return MyRouteLogin();
|
215
|
|
- }),
|
216
|
|
- );
|
217
|
|
- },
|
218
|
|
- ),
|
219
|
|
- )
|
220
|
|
- ],
|
221
|
|
- ))));
|
|
246
|
+ text: "登陆",
|
|
247
|
+ width: 200.0,
|
|
248
|
+ height: 50.0,
|
|
249
|
+ fontSize: 20.0,
|
|
250
|
+ backColor: Color(0xffff703b),
|
|
251
|
+ color: Colors.white,
|
|
252
|
+ onPressed: () {
|
|
253
|
+ Navigator.push(
|
|
254
|
+ context,
|
|
255
|
+ MaterialPageRoute(builder: (context) {
|
|
256
|
+ return MyRouteLogin();
|
|
257
|
+ }),
|
|
258
|
+ );
|
|
259
|
+ },
|
|
260
|
+ ),
|
|
261
|
+ )
|
|
262
|
+ ],
|
|
263
|
+ ))));
|
222
|
264
|
}
|
223
|
265
|
}
|