369 lines
15 KiB
Dart
369 lines
15 KiB
Dart
import 'dart:async';
|
|
import 'dart:math';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
import '../../components/my_app_bar.dart';
|
|
import '../../util/util.dart';
|
|
import 'logic.dart';
|
|
|
|
class PhotoinfoPage extends StatelessWidget {
|
|
PhotoinfoPage({Key? key}) : super(key: key);
|
|
|
|
//
|
|
// final logic = Get.lazyPut(() => PhotoinfoLogic());
|
|
// @override
|
|
// void dispose() {
|
|
// _timer?.cancel();
|
|
// super.dispose();
|
|
// }
|
|
|
|
|
|
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GetBuilder<PhotoinfoLogic>(builder: (logic) {
|
|
return Container(
|
|
decoration: BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage(getBaseImage("home_back")),
|
|
fit: BoxFit.cover,
|
|
),
|
|
),
|
|
child: Scaffold(
|
|
backgroundColor: Colors.transparent,
|
|
appBar: const MyAppBar(
|
|
centerTitle: '换绑手机号',
|
|
),
|
|
body: Scaffold(
|
|
backgroundColor: Colors.transparent,
|
|
body: SingleChildScrollView(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Container(
|
|
margin: EdgeInsets.only(
|
|
left: 16.0.sp,
|
|
top: 16.0.sp,
|
|
right: 16.0.sp,
|
|
),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(4.0.sp),
|
|
color: Color(0xff282733),
|
|
),
|
|
height: 40.0.sp,
|
|
child: Row(
|
|
// mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Container(
|
|
alignment: Alignment.centerLeft,
|
|
padding:
|
|
EdgeInsets.only(left: 16.0.sp, right: 10.sp,top: 4.sp),
|
|
child: Text(
|
|
"+86",
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 14.0.sp,
|
|
),
|
|
)),
|
|
Expanded(
|
|
child: Container(
|
|
height: 32.sp,
|
|
alignment: Alignment.center,
|
|
child: TextField(
|
|
controller: logic.photoController,
|
|
textAlignVertical: TextAlignVertical.center,
|
|
inputFormatters: [
|
|
FilteringTextInputFormatter.digitsOnly,
|
|
FilteringTextInputFormatter.deny(
|
|
RegExp('[^0-9]')),
|
|
],
|
|
maxLines: 1,
|
|
maxLength: 11,
|
|
keyboardType: TextInputType.phone,
|
|
decoration: InputDecoration(
|
|
hintText: "请输入已绑定手机号",
|
|
counterText:"",
|
|
hintStyle: TextStyle(
|
|
color: Colors.grey.shade300,
|
|
fontSize: 14.0.sp,
|
|
),
|
|
border: InputBorder.none,
|
|
),
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 14.0.sp,
|
|
height: 1.0.sp,
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
// Container(
|
|
// margin: EdgeInsets.fromLTRB(16.0, 20.0, 16.0, 0.0),
|
|
// decoration: BoxDecoration(
|
|
// borderRadius: BorderRadius.circular(4.0),
|
|
// color: Color(0xff282733),
|
|
// ),
|
|
// height: 40.0,
|
|
// child: Row(
|
|
// children: [
|
|
// Container(
|
|
// alignment: Alignment.centerLeft,
|
|
// padding: EdgeInsets.only(left: 10.0.sp, right: 10.sp),
|
|
// child: Image(
|
|
// image: AssetImage(getMineImage("im_lock")),
|
|
// width: 24.sp,
|
|
// height: 24.sp,
|
|
// ),
|
|
// ),
|
|
// Expanded(
|
|
// child: Container(
|
|
// height: 32.sp,
|
|
// alignment: Alignment.center,
|
|
// child: TextField(
|
|
// controller: _passwordController,
|
|
// textAlignVertical: TextAlignVertical.center,
|
|
// obscureText: true, // 设置为true以隐藏用户输入的内容
|
|
//
|
|
// decoration: InputDecoration(
|
|
// hintText: "请输入密码",
|
|
// hintStyle: TextStyle(
|
|
// color: Colors.grey.shade300,
|
|
// fontSize: 14.0,
|
|
// ),
|
|
// border: InputBorder.none,
|
|
// ),
|
|
// style: TextStyle(
|
|
// color: Colors.white,
|
|
// fontSize: 14.0,
|
|
// height: 1.0,
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// )
|
|
// ],
|
|
// ),
|
|
// ),
|
|
Container(
|
|
margin:
|
|
EdgeInsets.fromLTRB(16.0.sp, 20.0.sp, 16.0.sp, 0.0.sp),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(4.0.sp),
|
|
color: Color(0xff282733),
|
|
),
|
|
height: 40.0.sp,
|
|
child: Row(
|
|
children: [
|
|
Padding(
|
|
padding:
|
|
EdgeInsets.only(left: 16.0.sp, right: 10.sp,top: 4.sp),
|
|
child: Center(
|
|
child: Text(
|
|
"+86",
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 14.0.sp,
|
|
),
|
|
),
|
|
)),
|
|
Expanded(
|
|
child: Container(
|
|
height: 32.sp,
|
|
alignment: Alignment.center,
|
|
child: TextField(
|
|
controller: logic.newPhotoController,
|
|
textAlignVertical: TextAlignVertical.center,
|
|
keyboardType: TextInputType.phone,
|
|
inputFormatters: [
|
|
FilteringTextInputFormatter.digitsOnly,
|
|
FilteringTextInputFormatter.deny(
|
|
RegExp('[^0-9]')),
|
|
],
|
|
maxLines: 1,
|
|
maxLength: 11,
|
|
decoration: InputDecoration(
|
|
hintText: "请输入新手机号",
|
|
counterText: '',
|
|
hintStyle: TextStyle(
|
|
color: Colors.grey.shade300,
|
|
|
|
fontSize: 14.0.sp,
|
|
),
|
|
border: InputBorder.none,
|
|
),
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 14.0.sp,
|
|
height: 1.0.sp,
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
flex: 4,
|
|
child: Container(
|
|
margin: EdgeInsets.fromLTRB(
|
|
16.0.sp, 20.0.sp, 8.0.sp, 0.0.sp),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(4.0.sp),
|
|
color: Color(0xff282733),
|
|
),
|
|
height: 40.0.sp,
|
|
child: Row(
|
|
children: [
|
|
Container(
|
|
alignment: Alignment.centerLeft,
|
|
padding: EdgeInsets.only(
|
|
left: 10.0.sp, right: 10.sp),
|
|
child: Image(
|
|
image: AssetImage(getMineImage("im_shield")),
|
|
width: 24.sp,
|
|
height: 24.sp,
|
|
),
|
|
),
|
|
Expanded(
|
|
child: Container(
|
|
height: 32.sp,
|
|
alignment: Alignment.center,
|
|
child: TextField(
|
|
controller: logic.codeController,
|
|
textAlignVertical: TextAlignVertical.center,
|
|
decoration: InputDecoration(
|
|
hintText: "请输入验证码",
|
|
hintStyle: TextStyle(
|
|
color: Colors.grey.shade300,
|
|
fontSize: 14.0.sp,
|
|
),
|
|
border: InputBorder.none,
|
|
),
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 14.0.sp,
|
|
height: 1.0.sp,
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
flex: 2,
|
|
child: GestureDetector(
|
|
onTap: () {
|
|
if (!logic.isCountingDown) {
|
|
logic.getCode();
|
|
//logic.startCountdown();
|
|
}
|
|
},
|
|
child: Container(
|
|
margin: EdgeInsets.fromLTRB(
|
|
8.0.sp, 20.0.sp, 16.0.sp, 0.0.sp),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(4.0.sp),
|
|
color: Color(0xff282733),
|
|
),
|
|
height: 40.0.sp,
|
|
child: Center(
|
|
child: Text(
|
|
logic.isCountingDown
|
|
? logic.countdownSeconds.toString()+"s"
|
|
: '获取验证码',
|
|
style: TextStyle(
|
|
color: logic.isCountingDown
|
|
? Colors.grey.shade400
|
|
: Colors.white,
|
|
fontSize: 14.0.sp,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Padding(
|
|
padding:
|
|
EdgeInsets.fromLTRB(20.0.sp, 20.0.sp, 20.0.sp, 0.0.sp),
|
|
child: Text(
|
|
"温馨提示:换绑成功后,将退出软件使用新手机号重新登录,旧手机号无法登录此账号,但可以重新注册。",
|
|
style: TextStyle(
|
|
color: Colors.grey.shade400,
|
|
fontSize: 12.0.sp,
|
|
),
|
|
),
|
|
),
|
|
GestureDetector(
|
|
onTap: () {
|
|
String photo = logic.photoController.text;
|
|
// String password = logic.state.passwordController.text;
|
|
String newphoto = logic.newPhotoController.text;
|
|
String code = logic.codeController.text;
|
|
if (photo == "" || photo.length < 11) {
|
|
showToast("已绑定的手机号输入有误");
|
|
return;
|
|
}
|
|
// if(password==""){
|
|
// showToast("请输入密码");
|
|
// return ;
|
|
// }
|
|
if (newphoto == "" || newphoto.length < 11) {
|
|
showToast("新手机号输入有误");
|
|
return;
|
|
}
|
|
if (code == "") {
|
|
showToast("请输入验证码");
|
|
return;
|
|
}
|
|
logic.bindingPhoto();
|
|
// Perform action on button press
|
|
},
|
|
child: Container(
|
|
margin: EdgeInsets.fromLTRB(
|
|
72.0.sp, 40.0.sp, 72.0.sp, 0.0.sp),
|
|
height: 42.0.sp,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(17),
|
|
gradient: const LinearGradient(
|
|
colors: [
|
|
Color(0xFF06F9FA),
|
|
Color(0xFFDC5BFD),
|
|
],
|
|
begin: Alignment.centerLeft,
|
|
end: Alignment.centerRight,
|
|
),
|
|
),
|
|
child: Center(
|
|
child: Text(
|
|
"确定",
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 16.0.sp,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
});
|
|
}
|
|
}
|