bfb40cd0
liangchengyou
feat:忘记密码获取验证码
|
1
|
import 'package:flutter/gestures.dart';
|
2a29701f
liangchengyou
feat:提交代码
|
2
3
|
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
|
062f0df2
liangchengyou
feat:登录模块代码提交
|
4
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
fcc3a982
liangchengyou
feat:全局缓存bloc
|
5
|
import 'package:wow_english/common/blocs/cachebloc/cache_bloc.dart';
|
062f0df2
liangchengyou
feat:登录模块代码提交
|
6
|
import 'package:wow_english/common/extension/string_extension.dart';
|
1d5315dd
liangchengyou
feat:添加字体,调整文件结构
|
7
|
import 'package:wow_english/common/widgets/textfield_customer_widget.dart';
|
4b358e22
liangchengyou
feat:调整文件结构
|
8
|
import 'package:wow_english/pages/login/loginpage/time_widget.dart';
|
95edef4f
liangchengyou
feat:更新适配代码
|
9
|
import 'package:wow_english/route/route.dart';
|
2a29701f
liangchengyou
feat:提交代码
|
10
|
|
4b358e22
liangchengyou
feat:调整文件结构
|
11
12
|
import 'bloc/login_bloc.dart';
|
2a29701f
liangchengyou
feat:提交代码
|
13
|
class LoginPage extends StatelessWidget {
|
062f0df2
liangchengyou
feat:登录模块代码提交
|
14
|
const LoginPage({super.key});
|
2a29701f
liangchengyou
feat:提交代码
|
15
16
17
|
@override
Widget build(BuildContext context) {
|
2a29701f
liangchengyou
feat:提交代码
|
18
19
|
return BlocProvider(
create: (context) => LoginBloc(),
|
e1f36554
liangchengyou
feat:调整状态监听逻辑
|
20
21
22
23
24
25
26
27
28
29
30
|
child: _LoginPageView(),
);
}
}
class _LoginPageView extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocListener<LoginBloc,LoginState>(
listener: (context, state){
if (state is LoginResultChangeState) {
|
60e47f7c
liangchengyou
feat:课程选择功能
|
31
|
Navigator.of(context).pushNamed(AppRouteName.home);
|
e1f36554
liangchengyou
feat:调整状态监听逻辑
|
32
|
}
|
fcc3a982
liangchengyou
feat:全局缓存bloc
|
33
|
context.read<CacheBloc>().add(UserInfoChangeEvent(null));
|
e1f36554
liangchengyou
feat:调整状态监听逻辑
|
34
|
},
|
2a29701f
liangchengyou
feat:提交代码
|
35
36
37
38
39
40
41
42
|
child: _buildLoginViewWidget(),
);
}
Widget _buildLoginViewWidget() => BlocBuilder<LoginBloc,LoginState> (
builder: (context, state) {
final bloc = BlocProvider.of<LoginBloc>(context);
return Scaffold(
|
062f0df2
liangchengyou
feat:登录模块代码提交
|
43
44
|
body: SafeArea(
child: ListView(
|
2a29701f
liangchengyou
feat:提交代码
|
45
|
children: [
|
062f0df2
liangchengyou
feat:登录模块代码提交
|
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
Container(
padding: EdgeInsets.only(top: 25.h),
child: Stack(
children: [
Positioned(
right: 29.w,
child: GestureDetector(
onTap: () => bloc.add(ChangeLoginTypeEvent()),
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
'login_logo'.assetPng
),
fit: BoxFit.fill
),
),
|
f0d56772
liangchengyou
feat:更新尺寸适配
|
63
|
padding: EdgeInsets.symmetric(horizontal: 18.w,vertical: 5.h),
|
062f0df2
liangchengyou
feat:登录模块代码提交
|
64
|
child: Text(
|
056970d8
Key
feat: api
|
65
|
bloc.isSmsLoginType?'密码登陆':'验证码密码',
|
f0d56772
liangchengyou
feat:更新尺寸适配
|
66
67
68
|
style: TextStyle(
fontSize: 16.sp
),
|
062f0df2
liangchengyou
feat:登录模块代码提交
|
69
70
71
72
73
74
75
76
77
78
|
),
),
)
),
Center(
child: Column(
children: [
Image.asset(
'wow_logo'.assetPng,
height: 81.h,
|
1a43bf7c
liangchengyou
feat:更新UI
|
79
80
|
width: 131.w,
),
|
062f0df2
liangchengyou
feat:登录模块代码提交
|
81
|
Offstage(
|
056970d8
Key
feat: api
|
82
|
offstage: !bloc.isSmsLoginType,
|
062f0df2
liangchengyou
feat:登录模块代码提交
|
83
84
85
|
child: _buildSmsViewWidget(),
),
Offstage(
|
056970d8
Key
feat: api
|
86
|
offstage: bloc.isSmsLoginType,
|
062f0df2
liangchengyou
feat:登录模块代码提交
|
87
88
|
child: _buildPwdViewWidget(),
),
|
062f0df2
liangchengyou
feat:登录模块代码提交
|
89
90
91
92
93
94
95
96
97
98
|
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
GestureDetector(
onTap: () => bloc.add(AgreementChangeEvent()),
child: Icon(
bloc.agreement ? Icons.check_circle_outlined:Icons.circle_outlined,
color:bloc.agreement ? Colors.green:Colors.black),
),
6.horizontalSpace,
|
bfb40cd0
liangchengyou
feat:忘记密码获取验证码
|
99
100
101
|
RichText(
text: TextSpan(
children:[
|
f0d56772
liangchengyou
feat:更新尺寸适配
|
102
|
TextSpan(
|
bfb40cd0
liangchengyou
feat:忘记密码获取验证码
|
103
104
|
text: '我已阅读并同意',
style: TextStyle(
|
f0d56772
liangchengyou
feat:更新尺寸适配
|
105
106
|
fontSize: 12.sp,
color: const Color(0xFF333333),
|
bfb40cd0
liangchengyou
feat:忘记密码获取验证码
|
107
108
109
110
|
)
),
TextSpan(
text: '《用户隐私协议》',
|
f0d56772
liangchengyou
feat:更新尺寸适配
|
111
112
113
|
style: TextStyle(
fontSize: 12.sp,
color: const Color(0xFF333333),
|
bfb40cd0
liangchengyou
feat:忘记密码获取验证码
|
114
115
116
117
118
119
120
121
122
|
),
recognizer: TapGestureRecognizer()..onTap = (){
Navigator.of(context).pushNamed(
AppRouteName.webView,
arguments: {
'urlStr':'https://www.zhihu.com',
'webViewTitle':'用户隐私协议'
});
}),
|
f0d56772
liangchengyou
feat:更新尺寸适配
|
123
|
TextSpan(
|
bfb40cd0
liangchengyou
feat:忘记密码获取验证码
|
124
125
|
text: ',',
style: TextStyle(
|
f0d56772
liangchengyou
feat:更新尺寸适配
|
126
127
|
fontSize: 12.sp,
color: const Color(0xFF333333)
|
bfb40cd0
liangchengyou
feat:忘记密码获取验证码
|
128
129
130
131
|
)
),
TextSpan(
text: '《儿童隐私政策》',
|
f0d56772
liangchengyou
feat:更新尺寸适配
|
132
133
134
|
style: TextStyle(
fontSize: 12.sp,
color: const Color(0xFF333333)
|
bfb40cd0
liangchengyou
feat:忘记密码获取验证码
|
135
136
137
138
139
140
141
142
143
144
145
146
|
),
recognizer: TapGestureRecognizer()..onTap = (){
Navigator.of(context).pushNamed(
AppRouteName.webView,
arguments: {
'urlStr':'https://www.zhihu.com',
'webViewTitle':'儿童隐私协议'
});
})
]
),
)
|
062f0df2
liangchengyou
feat:登录模块代码提交
|
147
148
|
],
),
|
062f0df2
liangchengyou
feat:登录模块代码提交
|
149
|
GestureDetector(
|
1a43bf7c
liangchengyou
feat:更新UI
|
150
151
152
153
154
|
onTap: () {
if (bloc.canLogin) {
bloc.add(RequestLoginEvent());
}
},
|
062f0df2
liangchengyou
feat:登录模块代码提交
|
155
156
157
158
159
160
161
162
163
|
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
bloc.canLogin?'login_enter'.assetPng:'login_enter_dis'.assetPng
),
fit: BoxFit.fill
),
),
|
f0d56772
liangchengyou
feat:更新尺寸适配
|
164
165
166
|
padding: EdgeInsets.symmetric(
horizontal: 28.w,
vertical: 14.h
|
062f0df2
liangchengyou
feat:登录模块代码提交
|
167
|
),
|
f0d56772
liangchengyou
feat:更新尺寸适配
|
168
169
170
171
172
|
child: Text(
'登录',
style: TextStyle(
fontSize: 16.sp
),
|
062f0df2
liangchengyou
feat:登录模块代码提交
|
173
174
175
176
177
178
179
|
),
),
)
],
),
)
],
|
2a29701f
liangchengyou
feat:提交代码
|
180
181
182
183
184
185
186
187
|
),
)
],
),
),
);
},
);
|
062f0df2
liangchengyou
feat:登录模块代码提交
|
188
189
|
Widget _buildSmsViewWidget()=> BlocBuilder<LoginBloc,LoginState>(
|
17a80689
liangchengyou
feat:倒计时功能开发
|
190
|
builder: (context,state) {
|
062f0df2
liangchengyou
feat:登录模块代码提交
|
191
|
final bloc = BlocProvider.of<LoginBloc>(context);
|
2ca1b8bf
liangchengyou
feat:更新适配
|
192
|
return Padding(
|
1a43bf7c
liangchengyou
feat:更新UI
|
193
|
padding: EdgeInsets.symmetric(horizontal: 135.w),
|
2ca1b8bf
liangchengyou
feat:更新适配
|
194
195
196
|
child: Column(
children: [
15.verticalSpace,
|
1d5315dd
liangchengyou
feat:添加字体,调整文件结构
|
197
|
TextFieldCustomerWidget(
|
4bf67b91
liangchengyou
feat:设置密码
|
198
199
200
201
202
203
204
205
|
height: 55.h,
hitText: '请输入手机号',
textInputType: TextInputType.phone,
bgImageName: 'Input_layer_up',
onChangeValue: (String value) {
bloc.add(PhoneNumChangeEvent());
},
controller: bloc.phoneNumController,
|
2ca1b8bf
liangchengyou
feat:更新适配
|
206
207
|
),
6.5.verticalSpace,
|
f0d56772
liangchengyou
feat:更新尺寸适配
|
208
209
210
211
212
|
Text('未注册用户登录默认注册',
style: TextStyle(
fontSize: 12.sp,
color: const Color(0xFF999999)
),),
|
2ca1b8bf
liangchengyou
feat:更新适配
|
213
214
|
4.5.verticalSpace,
Row(
|
062f0df2
liangchengyou
feat:登录模块代码提交
|
215
216
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
|
1a43bf7c
liangchengyou
feat:更新UI
|
217
|
Expanded(
|
bfb40cd0
liangchengyou
feat:忘记密码获取验证码
|
218
219
220
221
222
223
224
225
226
227
|
child: TextFieldCustomerWidget(
height: 50.h,
hitText: '请输入验证码',
textInputType: TextInputType.number,
bgImageName: 'Input_layer_down',
onChangeValue: (String value) {
bloc.add(CheckFieldChangeEvent());
},
controller: bloc.checkNumController,
)
|
062f0df2
liangchengyou
feat:登录模块代码提交
|
228
|
),
|
f0d56772
liangchengyou
feat:更新尺寸适配
|
229
|
TimerWidget(canSendSms: bloc.canSendSms)
|
062f0df2
liangchengyou
feat:登录模块代码提交
|
230
|
],
|
2ca1b8bf
liangchengyou
feat:更新适配
|
231
232
233
|
)
],
),
|
062f0df2
liangchengyou
feat:登录模块代码提交
|
234
235
236
237
238
239
|
);
});
Widget _buildPwdViewWidget()=> BlocBuilder<LoginBloc,LoginState>(
builder: (context,state){
final bloc = BlocProvider.of<LoginBloc>(context);
|
1a43bf7c
liangchengyou
feat:更新UI
|
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
|
return Padding(
padding: EdgeInsets.symmetric(horizontal: 90.w),
child: Column(
children: [
15.verticalSpace,
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'phone'.assetPng,
height: 45.h,
width: 35.w,
),
10.5.horizontalSpace,
Expanded(
|
1d5315dd
liangchengyou
feat:添加字体,调整文件结构
|
255
|
child: TextFieldCustomerWidget(
|
4bf67b91
liangchengyou
feat:设置密码
|
256
257
258
259
260
261
262
263
264
265
|
height: 50.h,
hitText: '请输入手机号',
textInputType: TextInputType.phone,
bgImageName: 'Input_layer_up',
onChangeValue: (String value) {
bloc.add(PhoneNumChangeEvent());
},
controller: bloc.phoneNumController,
)
),
|
1a43bf7c
liangchengyou
feat:更新UI
|
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
|
5.horizontalSpace,
SizedBox(
width: 100.w,
height: 55.h,
)
],
),
12.verticalSpace,
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'lock'.assetPng,
height: 34.h,
width: 31.w,
),
10.5.horizontalSpace,
Expanded(
|
bfb40cd0
liangchengyou
feat:忘记密码获取验证码
|
284
285
286
287
288
289
290
291
|
child: TextFieldCustomerWidget(
hitText: '请输入密码',
bgImageName: 'Input_layer_down',
onChangeValue: (String value) {
bloc.add(CheckFieldChangeEvent());
},
controller: bloc.checkNumController,
)
|
1a43bf7c
liangchengyou
feat:更新UI
|
292
293
294
|
),
5.horizontalSpace,
GestureDetector(
|
95edef4f
liangchengyou
feat:更新适配代码
|
295
|
onTap: () {
|
1d5315dd
liangchengyou
feat:添加字体,调整文件结构
|
296
|
Navigator.of(context).pushNamed(AppRouteName.fogPwd);
|
95edef4f
liangchengyou
feat:更新适配代码
|
297
|
},
|
1a43bf7c
liangchengyou
feat:更新UI
|
298
299
300
301
|
child: Container(
width: 100.w,
height: 55.h,
alignment: Alignment.centerLeft,
|
f0d56772
liangchengyou
feat:更新尺寸适配
|
302
303
304
305
306
|
child: Text(
'忘记密码 ?',
style: TextStyle(
fontSize: 12.sp
),
|
2ca1b8bf
liangchengyou
feat:更新适配
|
307
|
),
|
062f0df2
liangchengyou
feat:登录模块代码提交
|
308
|
),
|
1a43bf7c
liangchengyou
feat:更新UI
|
309
310
311
312
313
|
)
],
)
],
),
|
062f0df2
liangchengyou
feat:登录模块代码提交
|
314
315
|
);
});
|
2a29701f
liangchengyou
feat:提交代码
|
316
|
}
|