4bf67b91
liangchengyou
feat:设置密码
|
1
2
3
4
|
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:wow_english/common/extension/string_extension.dart';
|
4b358e22
liangchengyou
feat:调整文件结构
|
5
|
import 'package:wow_english/common/widgets/textfield_customer_widget.dart';
|
e1f36554
liangchengyou
feat:调整状态监听逻辑
|
6
|
import 'package:wow_english/route/route.dart';
|
4bf67b91
liangchengyou
feat:设置密码
|
7
|
|
4b358e22
liangchengyou
feat:调整文件结构
|
8
9
|
import 'bloc/set_pwd_bloc.dart';
|
4bf67b91
liangchengyou
feat:设置密码
|
10
|
|
1d5315dd
liangchengyou
feat:添加字体,调整文件结构
|
11
|
class SetPassWordPage extends StatelessWidget {
|
65e33ae8
liangchengyou
feat:更新代码
|
12
|
const SetPassWordPage({super.key,this.phoneNum,this.code,this.type});
|
4bf67b91
liangchengyou
feat:设置密码
|
13
|
final String? phoneNum;
|
65e33ae8
liangchengyou
feat:更新代码
|
14
15
|
final String? code;
final int? type;
|
4bf67b91
liangchengyou
feat:设置密码
|
16
17
18
|
@override
Widget build(BuildContext context) {
|
4bf67b91
liangchengyou
feat:设置密码
|
19
|
return BlocProvider(
|
65e33ae8
liangchengyou
feat:更新代码
|
20
|
create: (context) => SetPwdBloc(phoneNum,code,type),
|
e1f36554
liangchengyou
feat:调整状态监听逻辑
|
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
child: _SetPassWordPageView(),
);
}
}
class _SetPassWordPageView extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocListener<SetPwdBloc, SetPwdState>(
listener: (context, s){
if (s is PasswordSetSuccessState) {
Navigator.of(context).pushNamedAndRemoveUntil(AppRouteName.home, (route) => false);
}
},
|
1d5315dd
liangchengyou
feat:添加字体,调整文件结构
|
35
36
37
38
39
40
41
42
43
44
45
46
|
child: _buildSetPwdView(),
);
}
Widget _buildSetPwdView() => BlocBuilder<SetPwdBloc, SetPwdState>(
builder: (context, state) {
final bloc = BlocProvider.of<SetPwdBloc>(context);
return Scaffold(
body: Container(
color: Colors.white,
child: SafeArea(
child: ListView(
|
4bf67b91
liangchengyou
feat:设置密码
|
47
|
children: [
|
1d5315dd
liangchengyou
feat:添加字体,调整文件结构
|
48
49
50
51
52
53
54
55
56
57
58
59
60
|
Padding(
padding: EdgeInsets.symmetric(horizontal: 40.w),
child: Column(
children: [
34.verticalSpace,
Row(
children: [
Image.asset(
'wow_logo'.assetPng,
height: 49.w,
width: 83.5.h,
),
12.5.horizontalSpace,
|
f0d56772
liangchengyou
feat:更新尺寸适配
|
61
|
Text(
|
1d5315dd
liangchengyou
feat:添加字体,调整文件结构
|
62
63
|
'欢迎登录wow english\n接下来请设置一下您的密码吧!',
style: TextStyle(
|
f0d56772
liangchengyou
feat:更新尺寸适配
|
64
65
|
fontSize: 16.5.sp,
color: const Color(0xFF666666)
|
1d5315dd
liangchengyou
feat:添加字体,调整文件结构
|
66
67
68
|
),
)
],
|
4bf67b91
liangchengyou
feat:设置密码
|
69
|
),
|
1d5315dd
liangchengyou
feat:添加字体,调整文件结构
|
70
71
|
Row(
crossAxisAlignment: CrossAxisAlignment.start,
|
4bf67b91
liangchengyou
feat:设置密码
|
72
|
children: [
|
1d5315dd
liangchengyou
feat:添加字体,调整文件结构
|
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
43.verticalSpace,
Row(
children: [
Expanded(
child: TextFieldCustomerWidget(
height: 55.h,
hitText: '请输入八位以上密码',
bgImageName: 'Input_layer_up',
controller: bloc.passWordFirstController,
obscureText: true,
textInputType: TextInputType.emailAddress,
onChangeValue: (String value) => bloc.add(PwdEnsureEvent()),
)
),
10.horizontalSpace,
Opacity(
opacity: bloc.showPwdIcon?1:0,
child: Image.asset(
bloc.passwordEnsure?'login_pass'.assetPng:'login_error'.assetPng,
height: 30,
width: 30,
),
)
],
|
4bf67b91
liangchengyou
feat:设置密码
|
101
|
),
|
1d5315dd
liangchengyou
feat:添加字体,调整文件结构
|
102
103
104
105
|
9.verticalSpace,
Offstage(
offstage: !bloc.passwordLarger,
child: const Text('您已达到密码最大输入数,请妥善调整密码'),
|
4bf67b91
liangchengyou
feat:设置密码
|
106
|
),
|
1d5315dd
liangchengyou
feat:添加字体,调整文件结构
|
107
108
109
110
111
112
113
114
115
116
117
118
119
|
9.verticalSpace,
Row(
children: [
Expanded(
child: TextFieldCustomerWidget(
height: 55.h,
hitText: '请再次输入相同密码',
bgImageName: 'Input_layer_up',
obscureText: true,
textInputType: TextInputType.emailAddress,
controller: bloc.passWordSecondController,
onChangeValue: (String value) => bloc.add(PwdCheckEvent()),
)
|
4bf67b91
liangchengyou
feat:设置密码
|
120
|
),
|
1d5315dd
liangchengyou
feat:添加字体,调整文件结构
|
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
10.horizontalSpace,
Opacity(
opacity: bloc.showCheckPwdIcon?1:0,
child: Image.asset(
bloc.passwordCheck?'login_pass'.assetPng:'login_error'.assetPng,
height: 30,
width: 30,
),
)
],
),
9.verticalSpace,
Offstage(
offstage: bloc.passwordCheck,
|
f0d56772
liangchengyou
feat:更新尺寸适配
|
135
|
child: Text(
|
1d5315dd
liangchengyou
feat:添加字体,调整文件结构
|
136
|
'请确认两次输入的密码是否一致',
|
4bf67b91
liangchengyou
feat:设置密码
|
137
|
style: TextStyle(
|
f0d56772
liangchengyou
feat:更新尺寸适配
|
138
139
|
fontSize: 16.sp,
color: const Color(0xFF333333)
|
4bf67b91
liangchengyou
feat:设置密码
|
140
141
142
|
),
),
),
|
1d5315dd
liangchengyou
feat:添加字体,调整文件结构
|
143
144
145
146
147
148
149
150
|
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
GestureDetector(
onTap: () {
if (!bloc.ensure) {
return;
}
|
e1f36554
liangchengyou
feat:调整状态监听逻辑
|
151
|
bloc.add(SetPasswordEvent());
|
1d5315dd
liangchengyou
feat:添加字体,调整文件结构
|
152
153
154
155
156
157
158
159
160
161
|
},
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
bloc.ensure?'login_enter'.assetPng:'login_enter_dis'.assetPng
),
fit: BoxFit.fill
),
),
|
f0d56772
liangchengyou
feat:更新尺寸适配
|
162
163
164
|
padding: EdgeInsets.symmetric(
horizontal: 28.w,
vertical: 14.h
|
1d5315dd
liangchengyou
feat:添加字体,调整文件结构
|
165
|
),
|
f0d56772
liangchengyou
feat:更新尺寸适配
|
166
|
child: Text(
|
1d5315dd
liangchengyou
feat:添加字体,调整文件结构
|
167
168
|
'确定',
style: TextStyle(
|
f0d56772
liangchengyou
feat:更新尺寸适配
|
169
170
|
color: Colors.white,
fontSize: 16.sp
|
1d5315dd
liangchengyou
feat:添加字体,调整文件结构
|
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
|
),
),
),
),
50.horizontalSpace
],
)
],
),
),
30.horizontalSpace,
Image.asset(
'steven'.assetPng,
height: 254.h,
width: 100.w,
|
4bf67b91
liangchengyou
feat:设置密码
|
186
187
188
|
)
],
),
|
1d5315dd
liangchengyou
feat:添加字体,调整文件结构
|
189
190
191
|
],
),
)
|
4bf67b91
liangchengyou
feat:设置密码
|
192
193
194
195
|
],
),
),
),
|
1d5315dd
liangchengyou
feat:添加字体,调整文件结构
|
196
197
198
|
);
}
);
|
4bf67b91
liangchengyou
feat:设置密码
|
199
|
}
|