After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 696 B |
After Width: | Height: | Size: 1020 B |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 910 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 86 KiB |
After Width: | Height: | Size: 52 KiB |
After Width: | Height: | Size: 9.2 KiB |
After Width: | Height: | Size: 59 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 634 B |
After Width: | Height: | Size: 708 B |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 13 KiB |
@ -0,0 +1,322 @@
|
||||
import 'dart:convert'; |
||||
|
||||
import 'package:dio/dio.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; |
||||
import 'package:huixiang/retrofit/data/base_data.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:huixiang/view_widget/my_appbar.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
import 'package:shared_preferences/shared_preferences.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
import '../retrofit/data/user_info.dart'; |
||||
import '../view_widget/classic_header.dart'; |
||||
import '../view_widget/my_footer.dart'; |
||||
|
||||
class TradingCardPage extends StatefulWidget { |
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _TradingCardPage(); |
||||
} |
||||
} |
||||
|
||||
class _TradingCardPage extends State<TradingCardPage> { |
||||
ApiService apiService; |
||||
final RefreshController refreshController = RefreshController(); |
||||
UserInfo userInfo; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
SharedPreferences.getInstance().then((value) { |
||||
apiService = |
||||
ApiService(Dio(), context: context, token: value.getString("token")); |
||||
queryUserBalance(); |
||||
}); |
||||
} |
||||
|
||||
@override |
||||
void dispose() { |
||||
super.dispose(); |
||||
refreshController.dispose(); |
||||
} |
||||
|
||||
///查询会员信息 |
||||
queryUserBalance() async { |
||||
BaseData<UserInfo> baseData = |
||||
await apiService.queryInfo().catchError((onError) { |
||||
refreshController.refreshFailed(); |
||||
refreshController.loadFailed();}); |
||||
if (baseData != null && baseData.isSuccess) { |
||||
userInfo = baseData.data; |
||||
if (mounted) setState(() {}); |
||||
refreshController.refreshCompleted(); |
||||
refreshController.loadComplete(); |
||||
}else { |
||||
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); |
||||
refreshController.refreshFailed(); |
||||
refreshController.loadFailed(); |
||||
} |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Container( |
||||
color: Colors.white, |
||||
child: Stack( |
||||
children: [ |
||||
Container( |
||||
decoration: BoxDecoration( |
||||
image: DecorationImage( |
||||
fit: BoxFit.fill, |
||||
image: AssetImage("assets/image/settlement_bg.webp"), |
||||
), |
||||
), |
||||
width: double.infinity, |
||||
height: 306.h, |
||||
), |
||||
Scaffold( |
||||
backgroundColor: Colors.transparent, |
||||
appBar: MyAppBar( |
||||
title: "", |
||||
titleColor: Colors.white, |
||||
background: Colors.transparent, |
||||
leadingColor: Colors.white, |
||||
brightness: Brightness.dark, |
||||
), |
||||
body: SmartRefresher( |
||||
controller: refreshController, |
||||
enablePullDown: true, |
||||
enablePullUp: false, |
||||
header: MyHeader( |
||||
color: Colors.white, |
||||
), |
||||
footer: CustomFooter( |
||||
builder: (context, mode) { |
||||
return MyFooter(mode); |
||||
}, |
||||
), |
||||
onRefresh: () { |
||||
queryUserBalance(); |
||||
}, |
||||
physics: BouncingScrollPhysics(), |
||||
scrollController: ScrollController(), |
||||
child: SingleChildScrollView( |
||||
physics: BouncingScrollPhysics(), |
||||
child:Container( |
||||
margin: EdgeInsets.symmetric(horizontal:14.w), |
||||
child:Column( |
||||
children: [ |
||||
Container( |
||||
width: double.infinity, |
||||
padding:EdgeInsets.only(top:24.h,bottom: 27.h) , |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
borderRadius: BorderRadius.circular(12), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 4), |
||||
blurRadius: 8, |
||||
spreadRadius: 8, |
||||
) |
||||
], |
||||
), |
||||
child: Column( |
||||
children:[ |
||||
Image.asset( |
||||
"assets/image/my_trading.webp", |
||||
width:200.w, |
||||
fit: BoxFit.fill, |
||||
height:22.h, |
||||
), |
||||
SizedBox(height:28.h), |
||||
Image.asset( |
||||
"assets/image/trading_logo.webp", |
||||
width:196.w, |
||||
fit: BoxFit.fill, |
||||
height:150.h, |
||||
), |
||||
Padding(padding:EdgeInsets.only(top: 21.h,bottom: 17.h), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
children: [ |
||||
Text( |
||||
"我已收集", |
||||
style: TextStyle( |
||||
color: Colors.black, |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
SizedBox(width: 12.w,), |
||||
Text( |
||||
(userInfo?.happyBean ?? 0).toString(), |
||||
style: TextStyle( |
||||
color: Color(0xFF32A060), |
||||
fontSize: 18.sp, |
||||
fontWeight: MyFontWeight.regular), |
||||
) |
||||
], |
||||
),), |
||||
Padding(padding:EdgeInsets.only(bottom:31.h), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
children: [ |
||||
Padding(padding:EdgeInsets.only(right:1.w), |
||||
child: GestureDetector( |
||||
onTap: (){ |
||||
Navigator.of(context).pushNamed('/router/welfare_exchange'); |
||||
}, |
||||
child: Text( |
||||
"兑换区逛逛", |
||||
style: TextStyle( |
||||
color: Color(0xFF32A060), |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
)), |
||||
Image.asset( |
||||
"assets/image/icon_right_z.webp", |
||||
width:16, |
||||
fit: BoxFit.fill, |
||||
height:16, |
||||
color: Color(0xFF32A060), |
||||
) |
||||
], |
||||
),), |
||||
Image.asset( |
||||
"assets/image/trading_text.webp", |
||||
width:314.w, |
||||
fit: BoxFit.cover, |
||||
height:98.h, |
||||
), |
||||
] |
||||
), |
||||
), |
||||
Container( |
||||
width: double.infinity, |
||||
padding:EdgeInsets.symmetric(vertical: 17.h,horizontal: 32.w) , |
||||
margin: EdgeInsets.only(top:16.h), |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
borderRadius: BorderRadius.circular(12), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 4), |
||||
blurRadius: 8, |
||||
spreadRadius: 8, |
||||
) |
||||
], |
||||
), |
||||
child: Row( |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/trading_history.webp", |
||||
width:16.h, |
||||
fit: BoxFit.fill, |
||||
height:16.h, |
||||
), |
||||
GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap:(){ |
||||
Navigator.of(context) |
||||
.pushNamed('/router/exchange_history_page'); |
||||
}, |
||||
child: Padding(padding:EdgeInsets.only(left: 4.w), |
||||
child: Text( |
||||
"兑换记录", |
||||
style: TextStyle( |
||||
color: Color(0xFF0D0D0D), |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular), |
||||
)), |
||||
), |
||||
Spacer(), |
||||
Container( |
||||
width: 1.w, |
||||
height: 35.5.h, |
||||
margin: EdgeInsets.symmetric(), |
||||
color:Color(0xFFD8D8D8)), |
||||
Spacer(), |
||||
Image.asset( |
||||
"assets/image/trading_detail.webp", |
||||
width:16.h, |
||||
fit: BoxFit.fill, |
||||
height:16.h, |
||||
), |
||||
GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: (){ |
||||
Navigator.of(context).pushNamed('/router/integral_detailed_page',arguments:{"titleType":1}); |
||||
}, |
||||
child: Padding(padding:EdgeInsets.only(left: 4.w), |
||||
child: Text( |
||||
"印章明细", |
||||
style: TextStyle( |
||||
color: Color(0xFF0D0D0D), |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular), |
||||
)),) |
||||
], |
||||
), |
||||
), |
||||
Container( |
||||
width: double.infinity, |
||||
padding:EdgeInsets.symmetric(vertical:12.h,horizontal: 11.w) , |
||||
margin: EdgeInsets.only(top:16.h), |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
borderRadius: BorderRadius.circular(12), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 4), |
||||
blurRadius: 8, |
||||
spreadRadius: 8, |
||||
) |
||||
], |
||||
), |
||||
child: Column( |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Padding(padding:EdgeInsets.only(bottom:14.h), |
||||
child: Text( |
||||
"规则介绍", |
||||
style: TextStyle( |
||||
color: Color(0xFF0D0D0D), |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.semi_bold), |
||||
),), |
||||
Padding(padding:EdgeInsets.only(bottom:12.h), |
||||
child: Text( |
||||
"(1) 商品中所要求的印章达到方可兑换", |
||||
style: TextStyle( |
||||
color: Color(0xFF353535), |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular), |
||||
),), |
||||
Text( |
||||
"(2) 印章卡仅兑换商城指定商品,不能折算现金或兑换其他非指定商品项目", |
||||
style: TextStyle( |
||||
color: Color(0xFF353535), |
||||
fontSize: 12.sp, |
||||
height: 1.5.h, |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
], |
||||
), |
||||
) |
||||
], |
||||
), |
||||
), |
||||
), |
||||
), |
||||
) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,806 @@
|
||||
import 'dart:async'; |
||||
import 'dart:io'; |
||||
|
||||
import 'package:dio/dio.dart'; |
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter/services.dart'; |
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/data/base_data.dart'; |
||||
import 'package:huixiang/retrofit/data/user_info.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:shared_preferences/shared_preferences.dart'; |
||||
|
||||
import '../view_widget/border_text.dart'; |
||||
|
||||
class BindingPhonePage extends StatefulWidget { |
||||
final Map<String, dynamic> arguments; |
||||
|
||||
BindingPhonePage({this.arguments}); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _BindingPhonePage(); |
||||
} |
||||
} |
||||
|
||||
class _BindingPhonePage extends State<BindingPhonePage> { |
||||
ApiService apiService; |
||||
String area = "+86"; |
||||
var _controllerPhone = TextEditingController(); |
||||
var _controllerNewPhone = TextEditingController(); |
||||
var _controllerCode = TextEditingController(); |
||||
var _controllerNewCode = TextEditingController(); |
||||
Color statusCodeTextColor = Color(0xFF353535); |
||||
var verifyStatus = 0; |
||||
var mobileStatus = 0; |
||||
var btnText = "获取验证码"; |
||||
var _sendCodeStatus = 0; |
||||
Timer _timer; |
||||
UserInfo userInfo; |
||||
int phoneState = 1; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
userInfo = widget.arguments['userInfo']; |
||||
} |
||||
|
||||
@override |
||||
void dispose() { |
||||
if (_timer != null && _timer.isActive) _timer.cancel(); |
||||
super.dispose(); |
||||
} |
||||
|
||||
///修改绑定手机号码 |
||||
modifyPhoneCode(int state) async { |
||||
var mobile = _controllerPhone.text; |
||||
if (mobile == ""&& phoneState == 1) { |
||||
SmartDialog.showToast(S.of(context).qingshurushoujihao, alignment: Alignment.center); |
||||
return; |
||||
} |
||||
var newMobile = _controllerNewPhone.text; |
||||
if (newMobile == ""&& phoneState == 2) { |
||||
SmartDialog.showToast(S.of(context).qingshurushoujihao, alignment: Alignment.center); |
||||
return; |
||||
} |
||||
var code = _controllerCode.text; |
||||
if (code == "" && phoneState == 1) { |
||||
SmartDialog.showToast(S.of(context).qingshuruyanzhengma, alignment: Alignment.center); |
||||
return; |
||||
} |
||||
var newCode = _controllerNewCode.text; |
||||
if (newCode == "" && phoneState == 2) { |
||||
SmartDialog.showToast(S.of(context).qingshuruyanzhengma, alignment: Alignment.center); |
||||
return; |
||||
} |
||||
if (code.length != 6 && phoneState==1) { |
||||
SmartDialog.showToast(S.of(context).code_error, alignment: Alignment.center); |
||||
return; |
||||
} |
||||
if (newCode.length != 6 && phoneState == 2) { |
||||
SmartDialog.showToast(S.of(context).code_error, alignment: Alignment.center); |
||||
return; |
||||
} |
||||
if (apiService == null) { |
||||
SharedPreferences value = await SharedPreferences.getInstance(); |
||||
apiService = ApiService(Dio(), |
||||
context: context, token: value.getString("token"), showLoading: false); |
||||
} |
||||
BaseData baseData = await apiService.changePhone({ |
||||
"areaCode": area, |
||||
"capcha": phoneState == 1 ? code:newCode, |
||||
"mobile1": mobile, |
||||
"mobile2": newMobile, |
||||
"state": state, |
||||
}).catchError((error) {}); |
||||
if (baseData != null && baseData.isSuccess) { |
||||
if(state == 1){ |
||||
_timer.cancel(); |
||||
btnText = "获取验证码"; |
||||
_sendCodeStatus = 0; |
||||
phoneState = 2; |
||||
}else if(state == 2){ |
||||
phoneState = 3;} |
||||
setState(() {}); |
||||
} else { |
||||
setState(() {}); |
||||
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); |
||||
} |
||||
} |
||||
|
||||
///验证验证码 |
||||
verificationCode() async { |
||||
var mobile = _controllerPhone.text; |
||||
if (mobile == "" && phoneState == 1) { |
||||
SmartDialog.showToast(S.of(context).qingshurushoujihao, alignment: Alignment.center); |
||||
return; |
||||
} |
||||
var newMobile = _controllerNewPhone.text; |
||||
if (newMobile == "" && phoneState == 2) { |
||||
SmartDialog.showToast(S.of(context).qingshurushoujihao, alignment: Alignment.center); |
||||
return; |
||||
} |
||||
if (apiService == null) { |
||||
SharedPreferences value = await SharedPreferences.getInstance(); |
||||
apiService = ApiService(Dio(), |
||||
context: context, token: value.getString("token"), showLoading: false); |
||||
} |
||||
BaseData baseData = await apiService.changeSendVerify(mobile).catchError((error) {}); |
||||
if (baseData != null && baseData.isSuccess) { |
||||
_sendCodeStatus = 1; |
||||
countdown(); |
||||
SmartDialog.showToast(baseData.data ?? false, alignment: Alignment.center); |
||||
} else { |
||||
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); |
||||
} |
||||
} |
||||
|
||||
countdown() { |
||||
if (_timer != null && _timer.isActive) return; |
||||
int countdown = 60; |
||||
_timer = Timer.periodic(Duration(seconds: 1), (timer) { |
||||
countdown--; |
||||
if (countdown == 0) { |
||||
btnText = "重新发送"; |
||||
_sendCodeStatus = 0; |
||||
_timer.cancel(); |
||||
} else { |
||||
btnText = "${countdown}s"; |
||||
} |
||||
setState(() {}); |
||||
}); |
||||
} |
||||
|
||||
bool isPhone(mobile) { |
||||
RegExp exp = RegExp( |
||||
r'^((13[0-9])|(14[0-9])|(15[0-9])|(16[0-9])|(17[0-9])|(18[0-9])|(19[0-9]))\d{8}$'); |
||||
return exp.hasMatch(mobile); |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return GestureDetector( |
||||
behavior: HitTestBehavior.translucent, |
||||
onTap: () { |
||||
FocusScope.of(context).requestFocus(FocusNode()); |
||||
}, |
||||
child: Scaffold( |
||||
resizeToAvoidBottomInset: false, |
||||
appBar: AppBar( |
||||
backgroundColor: Colors.white, |
||||
leading: GestureDetector( |
||||
child: Icon( |
||||
Icons.arrow_back_ios, |
||||
color: Colors.black, |
||||
), |
||||
onTap: () { |
||||
Navigator.of(context).pop(); |
||||
}), |
||||
title: Text( |
||||
S.of(context).genggaibangdingshoujihao, |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.regular, |
||||
fontSize: 17.sp, |
||||
color: Color(0xFF0D0D0D), |
||||
), |
||||
), |
||||
centerTitle: true, |
||||
elevation: 0.0, |
||||
), |
||||
body: Container( |
||||
margin: EdgeInsets.only(top: 12.h), |
||||
padding: EdgeInsets.symmetric(horizontal:16.w), |
||||
color: Colors.white, |
||||
width: double.infinity, |
||||
child:Column( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
topSequence(), |
||||
if(phoneState != 3) |
||||
Align(alignment: Alignment.center, |
||||
child: Text( |
||||
phoneState == 1 ?"现手机号验证":"修改成新号码", |
||||
textAlign: TextAlign.center, |
||||
style: TextStyle( |
||||
color: Color(0xFF353535), |
||||
fontSize: 18.sp, |
||||
letterSpacing:1, |
||||
fontWeight: MyFontWeight.bold, |
||||
),)), |
||||
if(phoneState == 2) |
||||
Padding(padding:EdgeInsets.only(top: 14.h), |
||||
child: Text( |
||||
"当前手机号为${area + " ${userInfo?.phone ?? ""}"} 请输入新手机号:", |
||||
style: TextStyle( |
||||
color: Color(0xFFA29E9E), |
||||
fontSize: 14.sp, |
||||
letterSpacing:0.5, |
||||
fontWeight: MyFontWeight.medium, |
||||
),)), |
||||
if(phoneState == 1) |
||||
inputPhone(), |
||||
if(phoneState == 2) |
||||
newInputPhone(), |
||||
if(phoneState == 3) |
||||
bindingSuccess(), |
||||
], |
||||
), |
||||
), |
||||
)); |
||||
} |
||||
|
||||
///头部手机号流程顺序 |
||||
Widget topSequence(){ |
||||
return Container( |
||||
margin:EdgeInsets.only(top:35.h,bottom: 31.h), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Container( |
||||
decoration:BoxDecoration( |
||||
borderRadius: BorderRadius.circular(100.w), |
||||
color: Color(0xFF34995E), |
||||
), |
||||
padding: EdgeInsets.symmetric(horizontal:8.5.w,vertical:5.h), |
||||
child: Text( |
||||
"1", |
||||
textAlign: TextAlign.center, |
||||
style: TextStyle( |
||||
color: Colors.white, |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
),), |
||||
), |
||||
Container( |
||||
height: 1.h, |
||||
width: 74.w, |
||||
color: Color(0xFF34995E), |
||||
margin: EdgeInsets.symmetric(horizontal:8.w), |
||||
), |
||||
Container( |
||||
decoration:BoxDecoration( |
||||
borderRadius: BorderRadius.circular(100.w), |
||||
color: phoneState == 1?Color(0xFFB7D3C3) : Color(0xFF34995E), |
||||
), |
||||
padding: EdgeInsets.symmetric(horizontal:8.5.w,vertical:5.h), |
||||
child: Text( |
||||
"2", |
||||
textAlign: TextAlign.center, |
||||
style: TextStyle( |
||||
color: Colors.white, |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
),), |
||||
), |
||||
Container( |
||||
height: 1.h, |
||||
width: 74.w, |
||||
color: Color(0xFF34995E), |
||||
margin: EdgeInsets.symmetric(horizontal:8.w), |
||||
), |
||||
Container( |
||||
decoration:BoxDecoration( |
||||
borderRadius: BorderRadius.circular(100.w), |
||||
color: (phoneState !=3)?Color(0xFFB7D3C3) : Color(0xFF34995E), |
||||
), |
||||
padding: EdgeInsets.symmetric(horizontal:8.5.w,vertical:5.h), |
||||
child: Text( |
||||
"3", |
||||
textAlign: TextAlign.center, |
||||
style: TextStyle( |
||||
color: Colors.white, |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
),), |
||||
) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
///输入现在的手机号 |
||||
Widget inputPhone(){ |
||||
return Container( |
||||
margin:EdgeInsets.only(top:phoneState == 1?15.h:12.h,bottom:21.h,), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Padding(padding:EdgeInsets.only(bottom: 10.h), |
||||
child: Text( |
||||
"手机号", |
||||
style: TextStyle( |
||||
color: Color(0xFF181818), |
||||
fontSize: 16.sp, |
||||
fontWeight: MyFontWeight.bold, |
||||
),)), |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
GestureDetector( |
||||
onTap: () { |
||||
Navigator.of(context) |
||||
.pushNamed('/router/phone_address_page') |
||||
.then((value) { |
||||
if (value != null) |
||||
setState(() { |
||||
area = value; |
||||
}); |
||||
}); |
||||
}, |
||||
child: Text( |
||||
area, |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.regular, |
||||
fontSize: 16.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
), |
||||
)), |
||||
Icon( |
||||
Icons.keyboard_arrow_right, |
||||
size: 18, |
||||
color: Color(0xFF1A1A1A), |
||||
), |
||||
Container( |
||||
height: 30.h, |
||||
width: MediaQuery.of(context).size.width - 100.w, |
||||
margin: EdgeInsets.only(bottom:Platform.isIOS ? 10.h:0), |
||||
child: TextField( |
||||
style: TextStyle( |
||||
height: 1.h, |
||||
fontSize: 16.sp, |
||||
color: Color(0xFF353535), |
||||
), |
||||
onChanged: (value) { |
||||
if (value != null && value.isNotEmpty) { |
||||
if (isPhone(value)) { |
||||
mobileStatus = 1; |
||||
} else { |
||||
mobileStatus = 2; |
||||
} |
||||
} else { |
||||
mobileStatus = 0; |
||||
} |
||||
setState(() {}); |
||||
}, |
||||
controller: _controllerPhone, |
||||
keyboardType: TextInputType.phone, |
||||
decoration: InputDecoration( |
||||
errorBorder: InputBorder.none, |
||||
focusedBorder: InputBorder.none, |
||||
enabledBorder: InputBorder.none, |
||||
hintText: S.of(context).qingshurushoujihao, |
||||
// contentPadding: EdgeInsets.only(top: 12, bottom: 12, left: 12), |
||||
hintStyle: TextStyle( |
||||
fontSize: 14.sp, |
||||
color: Color(0xFFA29E9E), |
||||
), |
||||
), |
||||
textInputAction: TextInputAction.next, |
||||
inputFormatters: [ |
||||
LengthLimitingTextInputFormatter(11) |
||||
], |
||||
cursorColor: Colors.grey, |
||||
maxLines: 1, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
Container( |
||||
height: 1.h, |
||||
width: MediaQuery.of(context).size.width - 80.h, |
||||
color: _controllerPhone.text == "" |
||||
? Color(0xFFE7E3E3) |
||||
: Color(0xFF32A060), |
||||
margin: EdgeInsets.only(top: 10.h), |
||||
), |
||||
SizedBox( |
||||
height: 30.h, |
||||
), |
||||
Padding(padding:EdgeInsets.only(bottom: 10.h), |
||||
child: Text( |
||||
S.of(context).yanzhengma, |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.bold, |
||||
fontSize: 16.sp, |
||||
color: Color(0xFF181818), |
||||
), |
||||
)), |
||||
Container( |
||||
height: 30.h, |
||||
width: MediaQuery.of(context).size.width - 30.h, |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.end, |
||||
crossAxisAlignment: CrossAxisAlignment.end, |
||||
children: [ |
||||
Expanded( |
||||
child: TextField( |
||||
style: TextStyle( |
||||
height: 1.h, |
||||
fontSize: 16.sp, |
||||
color: statusCodeTextColor, |
||||
), |
||||
onChanged: (value) { |
||||
if (value != null && |
||||
value.isNotEmpty) { |
||||
if (value.length == 6) { |
||||
verifyStatus = 1; |
||||
} else { |
||||
verifyStatus = 2; |
||||
} |
||||
} else { |
||||
verifyStatus = 0; |
||||
} |
||||
setState(() {}); |
||||
}, |
||||
controller: _controllerCode, |
||||
keyboardType: TextInputType.phone, |
||||
decoration: InputDecoration( |
||||
errorBorder: InputBorder.none, |
||||
focusedBorder: InputBorder.none, |
||||
enabledBorder: InputBorder.none, |
||||
hintText:S.of(context).input_code_hide, |
||||
hintStyle: TextStyle( |
||||
fontSize: 14.sp, |
||||
color: Color(0xFFA29E9E), |
||||
), |
||||
), |
||||
textInputAction: TextInputAction.next, |
||||
inputFormatters: [ |
||||
LengthLimitingTextInputFormatter(6) |
||||
], |
||||
cursorColor: Colors.grey, |
||||
maxLines: 1, |
||||
), |
||||
flex: 4, |
||||
), |
||||
Expanded( |
||||
child: Container( |
||||
alignment: Alignment.bottomCenter, |
||||
child: InkWell( |
||||
onTap: (){ |
||||
verificationCode(); |
||||
}, |
||||
child: BorderText( |
||||
text: btnText, |
||||
borderColor: Colors.transparent, |
||||
borderWidth: 1.w, |
||||
radius: 2, |
||||
padding: EdgeInsets.only( |
||||
left: 6.w, |
||||
right: 6.w, |
||||
), |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.bold, |
||||
textColor: _sendCodeStatus == 0 |
||||
? Color(0xFF32A060) |
||||
: Color(0xFFA29E9E), |
||||
), |
||||
), |
||||
), |
||||
flex: 2, |
||||
) |
||||
], |
||||
), |
||||
), |
||||
Container( |
||||
height: 1.h, |
||||
width: MediaQuery.of(context).size.width - 10.h, |
||||
color: _controllerNewCode.text == "" |
||||
? Color(0xFFE7E3E3) |
||||
: Color(0xFF32A060), |
||||
margin: EdgeInsets.only(top: 10.h), |
||||
), |
||||
SizedBox( |
||||
height: 54.h, |
||||
), |
||||
Align(alignment: Alignment.center, |
||||
child: GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: (){ |
||||
modifyPhoneCode(1); |
||||
}, |
||||
child: Container( |
||||
decoration:BoxDecoration( |
||||
borderRadius: BorderRadius.circular(23), |
||||
color: Color(0xFF34995E), |
||||
), |
||||
padding: EdgeInsets.symmetric(vertical: 12.h,horizontal:65.w), |
||||
child: Text( |
||||
S.of(context).queding, |
||||
style: TextStyle( |
||||
color: Color(0xFFFFFFFF), |
||||
fontSize: 16.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
),), |
||||
), |
||||
),), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
///输入新的手机号 |
||||
Widget newInputPhone(){ |
||||
return Container( |
||||
margin:EdgeInsets.only(top:15.h,bottom:21.h,), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
///手机号 |
||||
Padding(padding:EdgeInsets.only(bottom: 10.h), |
||||
child: Text( |
||||
"手机号", |
||||
style: TextStyle( |
||||
color: Color(0xFF181818), |
||||
fontSize: 16.sp, |
||||
fontWeight: MyFontWeight.bold, |
||||
),)), |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
GestureDetector( |
||||
onTap: () { |
||||
Navigator.of(context) |
||||
.pushNamed('/router/phone_address_page') |
||||
.then((value) { |
||||
if (value != null) |
||||
setState(() { |
||||
area = value; |
||||
}); |
||||
}); |
||||
}, |
||||
child: Text( |
||||
area, |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.regular, |
||||
fontSize: 16.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
), |
||||
)), |
||||
Icon( |
||||
Icons.keyboard_arrow_right, |
||||
size: 18, |
||||
color: Color(0xFF1A1A1A), |
||||
), |
||||
Container( |
||||
height: 30.h, |
||||
width: MediaQuery.of(context).size.width - 100.w, |
||||
margin: EdgeInsets.only(bottom:Platform.isIOS ? 10.h:0), |
||||
child: TextField( |
||||
style: TextStyle( |
||||
height: 1.h, |
||||
fontSize: 16.sp, |
||||
color: Color(0xFF353535), |
||||
), |
||||
onChanged: (value) { |
||||
if (value != null && value.isNotEmpty) { |
||||
if (isPhone(value)) { |
||||
mobileStatus = 1; |
||||
} else { |
||||
mobileStatus = 2; |
||||
} |
||||
} else { |
||||
mobileStatus = 0; |
||||
} |
||||
setState(() {}); |
||||
}, |
||||
controller: _controllerNewPhone, |
||||
keyboardType: TextInputType.phone, |
||||
decoration: InputDecoration( |
||||
errorBorder: InputBorder.none, |
||||
focusedBorder: InputBorder.none, |
||||
enabledBorder: InputBorder.none, |
||||
hintText: S.of(context).qingshurushoujihao, |
||||
// contentPadding: EdgeInsets.only(top: 12, bottom: 12, left: 12), |
||||
hintStyle: TextStyle( |
||||
fontSize: 14.sp, |
||||
color: Color(0xFFA29E9E), |
||||
), |
||||
), |
||||
textInputAction: TextInputAction.next, |
||||
inputFormatters: [ |
||||
LengthLimitingTextInputFormatter(11) |
||||
], |
||||
cursorColor: Colors.grey, |
||||
maxLines: 1, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
Container( |
||||
height: 1.h, |
||||
width: MediaQuery.of(context).size.width - 10.h, |
||||
color: _controllerNewPhone.text == "" |
||||
? Color(0xFFE7E3E3) |
||||
: Color(0xFF32A060), |
||||
margin: EdgeInsets.only(top: 10.h), |
||||
), |
||||
SizedBox( |
||||
height: 30.h, |
||||
), |
||||
///验证码 |
||||
Padding(padding:EdgeInsets.only(bottom: 10.h), |
||||
child: Text( |
||||
S.of(context).yanzhengma, |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.bold, |
||||
fontSize: 16.sp, |
||||
color: Color(0xFF181818), |
||||
), |
||||
)), |
||||
Container( |
||||
height: 30.h, |
||||
width: MediaQuery.of(context).size.width - 30.h, |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.end, |
||||
crossAxisAlignment: CrossAxisAlignment.end, |
||||
children: [ |
||||
Expanded( |
||||
child: TextField( |
||||
style: TextStyle( |
||||
height: 1.h, |
||||
fontSize: 16.sp, |
||||
color: statusCodeTextColor, |
||||
), |
||||
onChanged: (value) { |
||||
if (value != null && |
||||
value.isNotEmpty) { |
||||
if (value.length == 6) { |
||||
verifyStatus = 1; |
||||
} else { |
||||
verifyStatus = 2; |
||||
} |
||||
} else { |
||||
verifyStatus = 0; |
||||
} |
||||
setState(() {}); |
||||
}, |
||||
controller: _controllerNewCode, |
||||
keyboardType: TextInputType.phone, |
||||
decoration: InputDecoration( |
||||
errorBorder: InputBorder.none, |
||||
focusedBorder: InputBorder.none, |
||||
enabledBorder: InputBorder.none, |
||||
hintText:S.of(context).input_code_hide, |
||||
hintStyle: TextStyle( |
||||
fontSize: 14.sp, |
||||
color: Color(0xFFA29E9E), |
||||
), |
||||
), |
||||
textInputAction: TextInputAction.next, |
||||
inputFormatters: [ |
||||
LengthLimitingTextInputFormatter(6) |
||||
], |
||||
cursorColor: Colors.grey, |
||||
maxLines: 1, |
||||
), |
||||
flex: 4, |
||||
), |
||||
Expanded( |
||||
child: Container( |
||||
alignment: Alignment.bottomCenter, |
||||
child: InkWell( |
||||
onTap:(){ |
||||
verificationCode(); |
||||
}, |
||||
child: BorderText( |
||||
text: btnText, |
||||
borderColor: Colors.transparent, |
||||
borderWidth: 1.w, |
||||
radius: 2, |
||||
padding: EdgeInsets.only( |
||||
left: 6.w, |
||||
right: 6.w, |
||||
), |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.bold, |
||||
textColor: _sendCodeStatus == 0 |
||||
? Color(0xFF32A060) |
||||
: Color(0xFFA29E9E), |
||||
), |
||||
), |
||||
), |
||||
flex: 2, |
||||
) |
||||
], |
||||
), |
||||
), |
||||
Container( |
||||
height: 1.h, |
||||
width: MediaQuery.of(context).size.width - 10.h, |
||||
color: _controllerNewCode.text == "" |
||||
? Color(0xFFE7E3E3) |
||||
: Color(0xFF32A060), |
||||
margin: EdgeInsets.only(top: 10.h), |
||||
), |
||||
SizedBox( |
||||
height: 54.h, |
||||
), |
||||
Align(alignment: Alignment.center, |
||||
child: GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: (){ |
||||
modifyPhoneCode(2); |
||||
}, |
||||
child: Container( |
||||
decoration:BoxDecoration( |
||||
borderRadius: BorderRadius.circular(23), |
||||
color: Color(0xFF34995E), |
||||
), |
||||
padding: EdgeInsets.symmetric(vertical: 12.h,horizontal:65.w), |
||||
child: Text( |
||||
"下一步", |
||||
style: TextStyle( |
||||
color: Color(0xFFFFFFFF), |
||||
fontSize: 16.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
),), |
||||
), |
||||
),), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget bindingSuccess(){ |
||||
return Container( |
||||
alignment: Alignment.center, |
||||
margin: EdgeInsets.only(top: 31.h), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/icon_order_success.webp", |
||||
fit: BoxFit.cover, |
||||
width: 76, |
||||
height: 76, |
||||
), |
||||
SizedBox( |
||||
height: 16.h, |
||||
), |
||||
Text( |
||||
"新号码绑定成功", |
||||
style: TextStyle( |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
fontSize: 18.sp, |
||||
color: Color(0xFF353535), |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 99.h, |
||||
), |
||||
GestureDetector( |
||||
onTap: () { |
||||
Navigator.of(context).pop(); |
||||
}, |
||||
child: Container( |
||||
decoration:BoxDecoration( |
||||
borderRadius: BorderRadius.circular(23), |
||||
color: Color(0xFF34995E), |
||||
), |
||||
padding: EdgeInsets.symmetric(vertical: 14.h,horizontal:65.w), |
||||
child: Text( |
||||
S.of(context).queren, |
||||
style: TextStyle( |
||||
color: Color(0xFFFFFFFF), |
||||
fontSize: 16.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
),), |
||||
), |
||||
) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
} |