You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
410 lines
15 KiB
410 lines
15 KiB
import 'package:dating_touchme_app/components/page_appbar.dart';
|
|
import 'package:dating_touchme_app/router/route_paths.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_datetime_picker_plus/flutter_datetime_picker_plus.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
import 'package:tdesign_flutter/tdesign_flutter.dart';
|
|
|
|
class CompleteInfo extends StatefulWidget {
|
|
const CompleteInfo({super.key});
|
|
|
|
@override
|
|
State<CompleteInfo> createState() => _CompleteInfoState();
|
|
}
|
|
|
|
class _CompleteInfoState extends State<CompleteInfo> {
|
|
|
|
|
|
String username = '';
|
|
final TextEditingController _usernameController = TextEditingController();
|
|
String code = '';
|
|
final TextEditingController _codeController = TextEditingController();
|
|
|
|
List<String> birthday = [];
|
|
|
|
String selected = '';
|
|
List<String> data = ['大专以下', '大专', '本科', '硕士及以上'];
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return DecoratedBox(
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topCenter,
|
|
end: Alignment.bottomCenter,
|
|
colors: [
|
|
Color.fromRGBO(248, 242, 255, 1.0), // rgba(248, 242, 255, 1)
|
|
Color.fromRGBO(247, 247, 247, 1.0), // rgba(247, 247, 247, 1)
|
|
],
|
|
stops: [0.0, 1.0],
|
|
),
|
|
),
|
|
child: Scaffold(
|
|
appBar: PageAppbar(title: "完善信息", backgroundColor: Colors.transparent,),
|
|
backgroundColor: Colors.transparent,
|
|
body: SingleChildScrollView(
|
|
child: Container(
|
|
width: 750.w,
|
|
padding: EdgeInsets.symmetric(horizontal: 50.w),
|
|
child: Column(
|
|
children: [
|
|
Stack(
|
|
children: [
|
|
Image.asset(
|
|
"assets/user_avatar.png",
|
|
width: 170.w,
|
|
height: 170.w,
|
|
),
|
|
Positioned(
|
|
right: 10.w,
|
|
bottom: 0,
|
|
child: Container(
|
|
width: 36.w,
|
|
height: 36.w,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.all(Radius.circular(36.w)),
|
|
border: Border.all(width: 1, color: Colors.white),
|
|
color: const Color.fromRGBO(51, 51, 51, 1)
|
|
),
|
|
child: Center(
|
|
child: Image.asset(
|
|
"assets/edit_white.png",
|
|
width: 19.w,
|
|
height: 19.w,
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
SizedBox(height: 58.w,),
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
"性别(注册后不可修改)",
|
|
style: TextStyle(
|
|
fontSize: 25.w,
|
|
color: const Color.fromRGBO(144, 144, 144, 1),
|
|
fontWeight: FontWeight.w500
|
|
),
|
|
)
|
|
],
|
|
),
|
|
SizedBox(height: 33.w,),
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Container(
|
|
width: 150.w,
|
|
height: 65.w,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.all(Radius.circular(65.w)),
|
|
color: const Color.fromRGBO(51, 51, 51, 1)
|
|
),
|
|
child: Center(
|
|
child: Icon(
|
|
Icons.male,
|
|
size: 35.w,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
),
|
|
SizedBox(width: 30.w,),
|
|
Container(
|
|
width: 150.w,
|
|
height: 65.w,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.all(Radius.circular(65.w)),
|
|
color: const Color.fromRGBO(51, 51, 51, 1)
|
|
),
|
|
child: Center(
|
|
child: Icon(
|
|
Icons.female,
|
|
size: 35.w,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
SizedBox(height: 40.w,),
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
"昵称",
|
|
style: TextStyle(
|
|
fontSize: 25.w,
|
|
color: const Color.fromRGBO(144, 144, 144, 1),
|
|
fontWeight: FontWeight.w500
|
|
),
|
|
)
|
|
],
|
|
),
|
|
SizedBox(height: 10.w,),
|
|
InputItem(child: TextField(
|
|
controller: _usernameController,
|
|
keyboardType: TextInputType.number,
|
|
style: TextStyle(
|
|
fontSize: ScreenUtil().setWidth(28),
|
|
height: 1
|
|
),
|
|
decoration: InputDecoration(
|
|
contentPadding: EdgeInsets.symmetric(
|
|
vertical: 0,
|
|
horizontal: 34.w
|
|
),
|
|
hintText: "请输入昵称",
|
|
|
|
suffixIcon: TextButton(
|
|
onPressed: (){
|
|
|
|
},
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Image.asset(
|
|
"assets/random.png",
|
|
width: 36.w,
|
|
height: 30.w,
|
|
),
|
|
SizedBox(width: 8.w,),
|
|
Text(
|
|
"随机",
|
|
style: TextStyle(
|
|
fontSize: ScreenUtil().setWidth(25),
|
|
color: const Color.fromRGBO(51, 51, 51, 1)
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
border: const OutlineInputBorder(
|
|
borderSide: BorderSide.none, // 这将移除边框 // 可选:设置圆角
|
|
),
|
|
// 如果你希望聚焦时和未聚焦时都没有边框,也可以设置 focusedBorder 和 enabledBorder
|
|
focusedBorder: const OutlineInputBorder(
|
|
borderSide: BorderSide.none,
|
|
borderRadius: BorderRadius.all(Radius.circular(8.0)),
|
|
),
|
|
enabledBorder: const OutlineInputBorder(
|
|
borderSide: BorderSide.none,
|
|
borderRadius: BorderRadius.all(Radius.circular(8.0)),
|
|
),
|
|
),
|
|
onChanged: (value){
|
|
username = value;
|
|
},
|
|
)),
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
"年龄",
|
|
style: TextStyle(
|
|
fontSize: 25.w,
|
|
color: const Color.fromRGBO(144, 144, 144, 1),
|
|
fontWeight: FontWeight.w500
|
|
),
|
|
)
|
|
],
|
|
),
|
|
SizedBox(height: 10.w,),
|
|
InputItem(child: InkWell(
|
|
onTap: (){
|
|
DatePicker.showDatePicker(context,
|
|
showTitleActions: true, onChanged: (date) {
|
|
print('change $date');
|
|
}, onConfirm: (date) {
|
|
print('confirm $date');
|
|
birthday = [date.year.toString(), date.month.toString(), date.day.toString()];
|
|
setState(() {
|
|
|
|
});
|
|
}, currentTime: birthday.isEmpty ? DateTime.now() : DateTime(int.parse(birthday[0]), int.parse(birthday[1]), int.parse(birthday[2])), locale: LocaleType.zh);
|
|
},
|
|
child: Container(
|
|
padding: EdgeInsets.symmetric(
|
|
vertical: 0,
|
|
horizontal: 34.w
|
|
),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
"请选择你的出生日期",
|
|
style: TextStyle(
|
|
fontSize: 28.w,
|
|
color: Colors.grey,
|
|
fontWeight: FontWeight.w500
|
|
),
|
|
),
|
|
Icon(
|
|
Icons.keyboard_arrow_right,
|
|
size: 22.w,
|
|
color: const Color.fromRGBO(51, 51, 51, 1),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
)),
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
"学历",
|
|
style: TextStyle(
|
|
fontSize: 25.w,
|
|
color: const Color.fromRGBO(144, 144, 144, 1),
|
|
fontWeight: FontWeight.w500
|
|
),
|
|
)
|
|
],
|
|
),
|
|
SizedBox(height: 10.w,),
|
|
InputItem(child: InkWell(
|
|
onTap: (){
|
|
TDPicker.showMultiPicker(context, title: '选择地区',
|
|
onConfirm: (e) {
|
|
setState(() {
|
|
selected = '${data[e[0]]}';
|
|
});
|
|
print(selected);
|
|
Navigator.of(context).pop();
|
|
}, data: [data]);
|
|
},
|
|
child: Container(
|
|
padding: EdgeInsets.symmetric(
|
|
vertical: 0,
|
|
horizontal: 34.w
|
|
),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
"请选择你的学历",
|
|
style: TextStyle(
|
|
fontSize: 28.w,
|
|
color: Colors.grey,
|
|
fontWeight: FontWeight.w500
|
|
),
|
|
),
|
|
Icon(
|
|
Icons.keyboard_arrow_right,
|
|
size: 22.w,
|
|
color: const Color.fromRGBO(51, 51, 51, 1),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
)),
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
"邀请码(非必填)",
|
|
style: TextStyle(
|
|
fontSize: 25.w,
|
|
color: const Color.fromRGBO(144, 144, 144, 1),
|
|
fontWeight: FontWeight.w500
|
|
),
|
|
)
|
|
],
|
|
),
|
|
SizedBox(height: 10.w,),
|
|
InputItem(child: TextField(
|
|
controller: _codeController,
|
|
keyboardType: TextInputType.number,
|
|
style: TextStyle(
|
|
fontSize: ScreenUtil().setWidth(28),
|
|
height: 1
|
|
),
|
|
decoration: InputDecoration(
|
|
contentPadding: EdgeInsets.symmetric(
|
|
vertical: 0,
|
|
horizontal: 34.w
|
|
),
|
|
hintText: "请输入邀请码",
|
|
|
|
border: const OutlineInputBorder(
|
|
borderSide: BorderSide.none, // 这将移除边框 // 可选:设置圆角
|
|
),
|
|
// 如果你希望聚焦时和未聚焦时都没有边框,也可以设置 focusedBorder 和 enabledBorder
|
|
focusedBorder: const OutlineInputBorder(
|
|
borderSide: BorderSide.none,
|
|
borderRadius: BorderRadius.all(Radius.circular(8.0)),
|
|
),
|
|
enabledBorder: const OutlineInputBorder(
|
|
borderSide: BorderSide.none,
|
|
borderRadius: BorderRadius.all(Radius.circular(8.0)),
|
|
),
|
|
),
|
|
onChanged: (value){
|
|
code = value;
|
|
},
|
|
)),
|
|
SizedBox(height: 144.w,),
|
|
InkWell(
|
|
onTap: (){
|
|
context.pushNamed(RouteNames.home);
|
|
},
|
|
child: Container(
|
|
width: 654.w,
|
|
height: 105.w,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.all(Radius.circular(105.w)),
|
|
gradient: LinearGradient(
|
|
begin: Alignment.centerLeft,
|
|
end: Alignment.centerRight,
|
|
colors: [
|
|
Color.fromRGBO(131, 89, 255, 1), // 起始颜色
|
|
Color.fromRGBO(61, 138, 224, 1), // 结束颜色
|
|
],
|
|
),
|
|
),
|
|
child: Center(
|
|
child: Text(
|
|
"开始交友",
|
|
style: TextStyle(
|
|
fontSize: 36.w,
|
|
color: Colors.white,
|
|
fontWeight: FontWeight.w500
|
|
),
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
class InputItem extends StatelessWidget {
|
|
final Widget child;
|
|
const InputItem({super.key, required this.child});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
margin: EdgeInsets.only(bottom: ScreenUtil().setWidth(40)),
|
|
child: Container(
|
|
height: ScreenUtil().setWidth(105),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.all(Radius.circular(105.w)),
|
|
color: const Color.fromRGBO(247, 247, 247, 1)
|
|
),
|
|
child: Center(
|
|
child: child,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|