Commit 1a43bf7cf58ac323981e1dfbfc8503d1e411957f

Authored by liangchengyou
1 parent 2ca1b8bf

feat:更新UI

Showing 1 changed file with 127 additions and 120 deletions
lib/login/login_page.dart
@@ -52,7 +52,8 @@ class LoginPage extends StatelessWidget { @@ -52,7 +52,8 @@ class LoginPage extends StatelessWidget {
52 Image.asset( 52 Image.asset(
53 'wow_logo'.assetPng, 53 'wow_logo'.assetPng,
54 height: 81.h, 54 height: 81.h,
55 - width: 139.w,), 55 + width: 131.w,
  56 + ),
56 Offstage( 57 Offstage(
57 offstage: bloc.loginType == LoginType.pwd, 58 offstage: bloc.loginType == LoginType.pwd,
58 child: _buildSmsViewWidget(), 59 child: _buildSmsViewWidget(),
@@ -61,7 +62,6 @@ class LoginPage extends StatelessWidget { @@ -61,7 +62,6 @@ class LoginPage extends StatelessWidget {
61 offstage: bloc.loginType == LoginType.sms, 62 offstage: bloc.loginType == LoginType.sms,
62 child: _buildPwdViewWidget(), 63 child: _buildPwdViewWidget(),
63 ), 64 ),
64 - 20.verticalSpace,  
65 Row( 65 Row(
66 mainAxisAlignment: MainAxisAlignment.center, 66 mainAxisAlignment: MainAxisAlignment.center,
67 children: [ 67 children: [
@@ -75,9 +75,12 @@ class LoginPage extends StatelessWidget { @@ -75,9 +75,12 @@ class LoginPage extends StatelessWidget {
75 const Text('我已阅读并同意《用户隐私协议》,《儿童隐私策略》') 75 const Text('我已阅读并同意《用户隐私协议》,《儿童隐私策略》')
76 ], 76 ],
77 ), 77 ),
78 - 14.5.verticalSpace,  
79 GestureDetector( 78 GestureDetector(
80 - onTap: () => bloc.add(ChangeLoginTypeEvent()), 79 + onTap: () {
  80 + if (bloc.canLogin) {
  81 + bloc.add(RequestLoginEvent());
  82 + }
  83 + },
81 child: Container( 84 child: Container(
82 decoration: BoxDecoration( 85 decoration: BoxDecoration(
83 image: DecorationImage( 86 image: DecorationImage(
@@ -113,12 +116,12 @@ class LoginPage extends StatelessWidget { @@ -113,12 +116,12 @@ class LoginPage extends StatelessWidget {
113 builder: (context,state){ 116 builder: (context,state){
114 final bloc = BlocProvider.of<LoginBloc>(context); 117 final bloc = BlocProvider.of<LoginBloc>(context);
115 return Padding( 118 return Padding(
116 - padding: const EdgeInsets.symmetric(horizontal: 340), 119 + padding: EdgeInsets.symmetric(horizontal: 135.w),
117 child: Column( 120 child: Column(
118 children: [ 121 children: [
119 15.verticalSpace, 122 15.verticalSpace,
120 Container( 123 Container(
121 - height: 55, 124 + height: 55.h,
122 width: double.infinity, 125 width: double.infinity,
123 alignment: Alignment.center, 126 alignment: Alignment.center,
124 decoration: BoxDecoration( 127 decoration: BoxDecoration(
@@ -126,9 +129,8 @@ class LoginPage extends StatelessWidget { @@ -126,9 +129,8 @@ class LoginPage extends StatelessWidget {
126 image: AssetImage( 129 image: AssetImage(
127 'Input_layer_up'.assetPng 130 'Input_layer_up'.assetPng
128 ), 131 ),
129 - fit: BoxFit.fitHeight 132 + fit: BoxFit.fitWidth
130 ), 133 ),
131 - color: Colors.red  
132 ), 134 ),
133 child: TextField( 135 child: TextField(
134 controller: bloc.phoneNumController, 136 controller: bloc.phoneNumController,
@@ -150,30 +152,32 @@ class LoginPage extends StatelessWidget { @@ -150,30 +152,32 @@ class LoginPage extends StatelessWidget {
150 Row( 152 Row(
151 mainAxisAlignment: MainAxisAlignment.spaceBetween, 153 mainAxisAlignment: MainAxisAlignment.spaceBetween,
152 children: [ 154 children: [
153 - Container(  
154 - width: 257,  
155 - height: 50,  
156 - alignment: Alignment.center,  
157 - decoration: BoxDecoration(  
158 - image: DecorationImage(  
159 - image: AssetImage(  
160 - 'Input_layer_down'.assetPng  
161 - )  
162 - )  
163 - ),  
164 - child: TextField(  
165 - controller: bloc.checkNumController,  
166 - textAlign: TextAlign.center,  
167 - textInputAction: TextInputAction.done,  
168 - keyboardType: TextInputType.number,  
169 - decoration: const InputDecoration(  
170 - hintText: '请输入验证码',  
171 - border: InputBorder.none, 155 + Expanded(
  156 + child: Container(
  157 + height: 50.h,
  158 + width: double.infinity,
  159 + alignment: Alignment.center,
  160 + decoration: BoxDecoration(
  161 + image: DecorationImage(
  162 + image: AssetImage(
  163 + 'Input_layer_down'.assetPng,
  164 + ),
  165 + )
172 ), 166 ),
173 - onChanged: (String value) {  
174 - bloc.add(CheckFieldChangeEvent());  
175 - },  
176 - ) 167 + child: TextField(
  168 + controller: bloc.checkNumController,
  169 + textAlign: TextAlign.center,
  170 + textInputAction: TextInputAction.done,
  171 + keyboardType: TextInputType.number,
  172 + decoration: const InputDecoration(
  173 + hintText: '请输入验证码',
  174 + border: InputBorder.none,
  175 + ),
  176 + onChanged: (String value) {
  177 + bloc.add(CheckFieldChangeEvent());
  178 + },
  179 + )
  180 + ),
177 ), 181 ),
178 GestureDetector( 182 GestureDetector(
179 onTap: () { 183 onTap: () {
@@ -206,101 +210,104 @@ class LoginPage extends StatelessWidget { @@ -206,101 +210,104 @@ class LoginPage extends StatelessWidget {
206 Widget _buildPwdViewWidget()=> BlocBuilder<LoginBloc,LoginState>( 210 Widget _buildPwdViewWidget()=> BlocBuilder<LoginBloc,LoginState>(
207 builder: (context,state){ 211 builder: (context,state){
208 final bloc = BlocProvider.of<LoginBloc>(context); 212 final bloc = BlocProvider.of<LoginBloc>(context);
209 - return Column(  
210 - children: [  
211 - 15.verticalSpace,  
212 - Row(  
213 - mainAxisAlignment: MainAxisAlignment.center,  
214 - children: [  
215 - Image.asset(  
216 - 'phone'.assetPng,  
217 - height: 45,  
218 - width: 35,  
219 - ),  
220 - 10.5.horizontalSpace,  
221 - Container(  
222 - height: 55,  
223 - width: double.infinity,  
224 - alignment: Alignment.center,  
225 - decoration: BoxDecoration(  
226 - image: DecorationImage(  
227 - image: AssetImage(  
228 - 'Input_layer_up'.assetPng 213 + return Padding(
  214 + padding: EdgeInsets.symmetric(horizontal: 90.w),
  215 + child: Column(
  216 + children: [
  217 + 15.verticalSpace,
  218 + Row(
  219 + mainAxisAlignment: MainAxisAlignment.center,
  220 + children: [
  221 + Image.asset(
  222 + 'phone'.assetPng,
  223 + height: 45.h,
  224 + width: 35.w,
  225 + ),
  226 + 10.5.horizontalSpace,
  227 + Expanded(
  228 + child: Container(
  229 + height: 55.h,
  230 + width: double.infinity,
  231 + alignment: Alignment.center,
  232 + decoration: BoxDecoration(
  233 + image: DecorationImage(
  234 + image: AssetImage(
  235 + 'Input_layer_up'.assetPng
  236 + ),
  237 + fit: BoxFit.fitWidth,
  238 + )
229 ), 239 ),
230 - fit: BoxFit.fill,  
231 - )  
232 - ),  
233 - child: TextField(  
234 - controller: bloc.phoneNumController,  
235 - textAlign: TextAlign.center,  
236 - textInputAction: TextInputAction.done,  
237 - decoration: const InputDecoration(  
238 - hintText: '请输入手机号',  
239 - border: InputBorder.none,  
240 - ),  
241 - keyboardType: TextInputType.phone,  
242 - onChanged: (String value) {  
243 - bloc.add(PhoneNumChangeEvent());  
244 - },  
245 - )  
246 - ),  
247 - 5.horizontalSpace,  
248 - const SizedBox(  
249 - width: 100,  
250 - height: 55.0,  
251 - )  
252 - ],  
253 - ),  
254 - 12.verticalSpace,  
255 - Row(  
256 - mainAxisAlignment: MainAxisAlignment.center,  
257 - children: [  
258 - Image.asset(  
259 - 'lock'.assetPng,  
260 - height: 34,  
261 - width: 31,  
262 - ),  
263 - 10.5.horizontalSpace,  
264 - Container(  
265 - width: 397.5,  
266 - height: 55,  
267 - alignment: Alignment.center,  
268 - decoration: BoxDecoration(  
269 - image: DecorationImage(  
270 - image: AssetImage(  
271 - 'Input_layer_down'.assetPng 240 + child: TextField(
  241 + controller: bloc.phoneNumController,
  242 + textAlign: TextAlign.center,
  243 + textInputAction: TextInputAction.done,
  244 + decoration: const InputDecoration(
  245 + hintText: '请输入手机号',
  246 + border: InputBorder.none,
  247 + ),
  248 + keyboardType: TextInputType.phone,
  249 + onChanged: (String value) {bloc.add(PhoneNumChangeEvent());},)
  250 + )),
  251 + 5.horizontalSpace,
  252 + SizedBox(
  253 + width: 100.w,
  254 + height: 55.h,
  255 + )
  256 + ],
  257 + ),
  258 + 12.verticalSpace,
  259 + Row(
  260 + mainAxisAlignment: MainAxisAlignment.center,
  261 + children: [
  262 + Image.asset(
  263 + 'lock'.assetPng,
  264 + height: 34.h,
  265 + width: 31.w,
  266 + ),
  267 + 10.5.horizontalSpace,
  268 + Expanded(
  269 + child: Container(
  270 + width: 397.5,
  271 + height: 55,
  272 + alignment: Alignment.center,
  273 + decoration: BoxDecoration(
  274 + image: DecorationImage(
  275 + image: AssetImage(
  276 + 'Input_layer_down'.assetPng
  277 + ),
  278 + fit: BoxFit.fill,
  279 + )
  280 + ),
  281 + child: TextField(
  282 + controller: bloc.checkNumController,
  283 + textAlign: TextAlign.center,
  284 + textInputAction: TextInputAction.done,
  285 + decoration: const InputDecoration(
  286 + hintText: '请输入密码',
  287 + border: InputBorder.none,
272 ), 288 ),
273 - fit: BoxFit.fill, 289 + onChanged: (String value) {
  290 + bloc.add(CheckFieldChangeEvent());
  291 + },
274 ) 292 )
275 ), 293 ),
276 - child: TextField(  
277 - controller: bloc.checkNumController,  
278 - textAlign: TextAlign.center,  
279 - textInputAction: TextInputAction.done,  
280 - decoration: const InputDecoration(  
281 - hintText: '请输入密码',  
282 - border: InputBorder.none, 294 + ),
  295 + 5.horizontalSpace,
  296 + GestureDetector(
  297 + onTap: () => bloc.add(ForgetPasswordEvent()),
  298 + child: Container(
  299 + width: 100.w,
  300 + height: 55.h,
  301 + alignment: Alignment.centerLeft,
  302 + child: const Text(
  303 + '忘记密码 ?'
283 ), 304 ),
284 - onChanged: (String value) {  
285 - bloc.add(CheckFieldChangeEvent());  
286 - },  
287 - )  
288 - ),  
289 - 5.horizontalSpace,  
290 - GestureDetector(  
291 - onTap: () => bloc.add(ForgetPasswordEvent()),  
292 - child: Container(  
293 - width: 100,  
294 - height: 55.0,  
295 - alignment: Alignment.centerLeft,  
296 - child: const Text(  
297 - '忘记密码 ?'  
298 ), 305 ),
299 - ),  
300 - )  
301 - ],  
302 - )  
303 - ], 306 + )
  307 + ],
  308 + )
  309 + ],
  310 + ),
304 ); 311 );
305 }); 312 });
306 313