From 6800ba8079421f5efd54382218292e551b66766e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=AD=90=E8=B4=A4?= Date: Tue, 25 Nov 2025 18:07:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../home/user_information_controller.dart | 67 ++ lib/controller/mine/edit_info_controller.dart | 113 ++- lib/network/api_urls.dart | 2 + lib/network/user_api.dart | 7 + lib/network/user_api.g.dart | 32 + lib/pages/home/content_card.dart | 2 +- lib/pages/home/user_information_page.dart | 743 +++++++++--------- lib/pages/mine/edit_info_page.dart | 101 ++- lib/pages/mine/my_wallet_page.dart | 459 +++++------ lib/pages/mine/pay_fail_page.dart | 44 +- lib/pages/mine/rose_history_page.dart | 123 ++- lib/pages/mine/withdraw_history_page.dart | 4 + 12 files changed, 944 insertions(+), 753 deletions(-) create mode 100644 lib/controller/home/user_information_controller.dart diff --git a/lib/controller/home/user_information_controller.dart b/lib/controller/home/user_information_controller.dart new file mode 100644 index 0000000..534e44b --- /dev/null +++ b/lib/controller/home/user_information_controller.dart @@ -0,0 +1,67 @@ +import 'package:dating_touchme_app/controller/global.dart'; +import 'package:dating_touchme_app/model/home/user_info_data.dart'; +import 'package:dating_touchme_app/network/user_api.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:get/get.dart'; + +class UserInformationController extends GetxController { + + final String miId; + final String userId; + UserInformationController({required this.miId, required this.userId}); + + final nowSelect = 0.obs; + + final userData = UserInfoData().obs; + + List tagList = [ + "北京", "160cm", "想要甜甜的恋爱", "本科", "朋友圈摄影师", "英雄联盟", "流放之路", + "CF", "DNA", "堡垒之夜", "SCP" + ]; + + late UserApi _userApi; + + + @override + void onInit() { + super.onInit(); + _userApi = Get.find(); + + getUserData(); + } + + int calculateAge(String birthdayStr) { + final birthday = DateTime.parse(birthdayStr); // 自动识别 1996-1-20 + final today = DateTime.now(); + + int age = today.year - birthday.year; + + // 如果今年生日还没过,年龄要减 1 + if (today.month < birthday.month || + (today.month == birthday.month && today.day < birthday.day)) { + age--; + } + + return age; + } + + final myUserData = GlobalData().userData.obs; + + getUserData() async { + try { + final response = await _userApi.getDongwoMarriageInformationDetail(miId: miId); + if (response.data.isSuccess && response.data.data != null) { + userData.value = response.data.data ?? UserInfoData(); + } else { + + // 响应失败,抛出异常 + throw Exception(response.data.message ?? '获取数据失败'); + } + } catch(e){ + print('钱包数据获取失败: $e'); + SmartDialog.showToast('钱包数据获取失败'); + rethrow; + + } + } +} \ No newline at end of file diff --git a/lib/controller/mine/edit_info_controller.dart b/lib/controller/mine/edit_info_controller.dart index 3bbb56c..5c14cff 100644 --- a/lib/controller/mine/edit_info_controller.dart +++ b/lib/controller/mine/edit_info_controller.dart @@ -31,6 +31,17 @@ class EditInfoController extends GetxController { final menuActive = 1.obs; + final birthday = ''.obs; + + + // 选择日期 + void selectBirthday(String selectedDate) { + birthday.value = selectedDate; + // 打印选择的日期 + print('选择的出生日期: $selectedDate'); + // 显示选择结果 + SmartDialog.showToast('出生日期已选择'); + } @@ -104,7 +115,7 @@ class EditInfoController extends GetxController { _userApi = Get.find(); - getEducationList(); + getIncomeList(); getMaritalList(); getPropertyList(); @@ -281,27 +292,10 @@ class EditInfoController extends GetxController { final data = response.data.data; - Get.to(() => UserInformationPage(userData: MarriageData( - miId: data?.miId ?? "", - userId: data?.userId ?? "", - profilePhoto: data?.profilePhoto ?? "", - nickName: data?.nickName ?? "", - isRealNameCertified: data?.identityCard == null, - birthYear: data?.birthYear ?? "", - birthDate: data?.birthDate ?? "", - age: int.parse(data?.age.toString() ?? "0"), - provinceCode: int.parse(data?.provinceCode.toString() ?? "0"), - provinceName: data?.provinceName ?? "", - cityCode: int.parse(data?.cityCode.toString() ?? "0"), - cityName: data?.cityName ?? "", - districtCode: int.parse(data?.districtCode.toString() ?? "0"), - districtName: data?.districtName ?? "", - describeInfo: data?.describeInfo ?? "", - createTime: data?.createTime ?? "", - photoList: data!.photoList!.map((e){ - return PhotoItem.fromJson(e.toJson()); - }).toList(), - ))); + Get.to(() => UserInformationPage( + miId: userData.value?.id ?? "", + userId: GlobalData().userId ?? "", + )); } else { // 响应失败,抛出异常 throw Exception(response.data.message ?? '获取数据失败'); @@ -415,17 +409,27 @@ class EditInfoController extends GetxController { final List? image = await picker.pickMultiImage(limit: 9 - imgList.length); if (image != null) { - for(int i = 0; i processSelectedMoreImage(File imageFile, int type) async { - if(type == 1){ - try { - // 显示加载提示 - SmartDialog.showLoading(msg: '上传头像中...'); - String objectName = '${DateUtil.getNowDateMs()}.${imageFile.path.split('.').last}'; - String imageUrl = await OSSManager.instance.uploadFile(imageFile.readAsBytesSync(), objectName); - print('上传成功,图片URL: $imageUrl'); - avatarUrl.value = imageUrl; - SmartDialog.dismiss(); - SmartDialog.showToast('头像上传成功'); - saveAvatar(); - } catch (e) { - SmartDialog.dismiss(); - print('处理图片失败: $e'); - SmartDialog.showToast('上传头像失败,请重试'); - } - } else { - try { - // 显示加载提示 - SmartDialog.showLoading(msg: '上传相册中...'); - String objectName = '${DateUtil.getNowDateMs()}.${imageFile.path.split('.').last}'; - String imageUrl = await OSSManager.instance.uploadFile(imageFile.readAsBytesSync(), objectName); - print('上传成功,图片URL: $imageUrl'); - imgList.add(imageUrl); - } catch (e) { - SmartDialog.dismiss(); - print('处理图片失败: $e'); - SmartDialog.showToast('上传相册失败,请重试'); - } + Future processSelectedMoreImage(File imageFile, int type) async { + try { + // 显示加载提示 + SmartDialog.showLoading(msg: '上传相册中...'); + String objectName = '${DateUtil.getNowDateMs()}.${imageFile.path.split('.').last}'; + String imageUrl = await OSSManager.instance.uploadFile(imageFile.readAsBytesSync(), objectName); + print('上传成功,图片URL: $imageUrl'); + return imageUrl; + } catch (e) { + SmartDialog.dismiss(); + print('处理图片失败: $e'); + SmartDialog.showToast('上传相册失败,请重试'); + return ""; } } diff --git a/lib/network/api_urls.dart b/lib/network/api_urls.dart index f789a3f..83102e2 100644 --- a/lib/network/api_urls.dart +++ b/lib/network/api_urls.dart @@ -76,6 +76,8 @@ class ApiUrls { 'dating-agency-mall/user/get/wallet-account'; static const String getWalletAccountRecord = 'dating-agency-mall/user/page/wallet-account-record'; + static const String getDongwoMarriageInformationDetail = + 'dating-agency-service/user/get/dongwo/marriage-information-detail'; //首页相关接口 static const String getMarriageList = diff --git a/lib/network/user_api.dart b/lib/network/user_api.dart index bf624ae..2e29f99 100644 --- a/lib/network/user_api.dart +++ b/lib/network/user_api.dart @@ -178,4 +178,11 @@ abstract class UserApi { @Query('recordTimeTo') required String recordTimeTo, } ); + + @GET(ApiUrls.getDongwoMarriageInformationDetail) + Future>> getDongwoMarriageInformationDetail( + { + @Query('miId') required String miId, + } + ); } diff --git a/lib/network/user_api.g.dart b/lib/network/user_api.g.dart index 817676b..eefaa2e 100644 --- a/lib/network/user_api.g.dart +++ b/lib/network/user_api.g.dart @@ -1097,6 +1097,38 @@ class _UserApi implements UserApi { return httpResponse; } + @override + Future>> + getDongwoMarriageInformationDetail({required String miId}) async { + final _extra = {}; + final queryParameters = {r'miId': miId}; + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + 'dating-agency-service/user/get/dongwo/marriage-information-detail', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late BaseResponse _value; + try { + _value = BaseResponse.fromJson( + _result.data!, + (json) => UserInfoData.fromJson(json as Map), + ); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + RequestOptions _setStreamType(RequestOptions requestOptions) { if (T != dynamic && !(requestOptions.responseType == ResponseType.bytes || diff --git a/lib/pages/home/content_card.dart b/lib/pages/home/content_card.dart index 45e5b15..a1659b7 100644 --- a/lib/pages/home/content_card.dart +++ b/lib/pages/home/content_card.dart @@ -270,7 +270,7 @@ class ContentCard extends StatelessWidget { return GestureDetector( onTap: () { // 点击卡片跳转到用户信息页面,传递用户数据 - Get.to(() => UserInformationPage(userData: item)); + Get.to(() => UserInformationPage(miId: item.miId, userId: item.userId,)); }, child: Container( decoration: BoxDecoration( diff --git a/lib/pages/home/user_information_page.dart b/lib/pages/home/user_information_page.dart index 2ba75d9..468459c 100644 --- a/lib/pages/home/user_information_page.dart +++ b/lib/pages/home/user_information_page.dart @@ -1,5 +1,6 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:dating_touchme_app/controller/global.dart'; +import 'package:dating_touchme_app/controller/home/user_information_controller.dart'; import 'package:dating_touchme_app/generated/assets.dart'; import 'package:dating_touchme_app/model/home/marriage_data.dart'; import 'package:dating_touchme_app/pages/home/report_page.dart'; @@ -9,457 +10,417 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:get/get_core/src/get_main.dart'; -class UserInformationPage extends StatefulWidget { - final MarriageData userData; +class UserInformationPage extends StatelessWidget { + final String miId; + final String userId; + const UserInformationPage({super.key, required this.miId, required this.userId}); - const UserInformationPage({super.key, required this.userData}); - - @override - State createState() => _UserInformationPageState(); -} - -class _UserInformationPageState extends State { - - List imgList = [ - "https://fastly.picsum.photos/id/64/800/800.jpg?hmac=NBZ4_-vqzD6p25oCeaW0H5vH-ql9zzei-SqJNeUo1QU", - "https://fastly.picsum.photos/id/985/800/800.jpg?hmac=DfRt99HFbMJ96DlN-poOhruWYRsexESE94ilLC3g1rU", - "https://fastly.picsum.photos/id/703/800/800.jpg?hmac=-bRTkPxnsiQ5kCo2tfXj6tFrXMD7YnVx7bQ0STno3Tg" - ]; - - int nowSelect = 0; - - List tagList = [ - "北京", "160cm", "想要甜甜的恋爱", "本科", "朋友圈摄影师", "英雄联盟", "流放之路", - "CF", "DNA", "堡垒之夜", "SCP" - ]; - - - - int calculateAge(String birthdayStr) { - final birthday = DateTime.parse(birthdayStr); // 自动识别 1996-1-20 - final today = DateTime.now(); - - int age = today.year - birthday.year; - - // 如果今年生日还没过,年龄要减 1 - if (today.month < birthday.month || - (today.month == birthday.month && today.day < birthday.day)) { - age--; - } - - return age; - } - - final userData = GlobalData().userData.obs; - - @override - void initState() { - super.initState(); - userData.value = GlobalData().userData; - } @override Widget build(BuildContext context) { - return Scaffold( - body: Stack( - children: [ - widget.userData.photoList.isNotEmpty ? CachedNetworkImage( - imageUrl: "${widget.userData.photoList[nowSelect].photoUrl}?x-oss-process=image/format,webp", - width: 375.w, - height: 384.w, - fit: BoxFit.cover, - ) : CachedNetworkImage( - imageUrl: "${widget.userData.avatar}?x-oss-process=image/format,webp", - width: 375.w, - height: 384.w, - fit: BoxFit.cover, - ), - SingleChildScrollView( - child: Container( - padding: EdgeInsets.only(top: 361.w), - child: Container( - height: 812.h - 361.w, + return GetX( + init: UserInformationController(miId: miId, userId: userId), + builder: (controller){ + return controller.userData.value.id != null ? Scaffold( + body: Stack( + children: [ + controller.userData.value.photoList!.isNotEmpty ? CachedNetworkImage( + imageUrl: "${controller.userData.value.photoList![controller.nowSelect.value].photoUrl}?x-oss-process=image/format,webp", width: 375.w, - padding: EdgeInsets.only( - top: 31.w, - left: 15.w, - right: 24.w - ), - decoration: BoxDecoration( - borderRadius: BorderRadius.vertical( - top: Radius.circular(23.w) + height: 384.w, + fit: BoxFit.cover, + ) : CachedNetworkImage( + imageUrl: "${controller.userData.value.profilePhoto}?x-oss-process=image/format,webp", + width: 375.w, + height: 384.w, + fit: BoxFit.cover, + ), + SingleChildScrollView( + child: Container( + padding: EdgeInsets.only(top: 361.w), + child: Container( + height: 812.h - 361.w, + width: 375.w, + padding: EdgeInsets.only( + top: 31.w, + left: 15.w, + right: 24.w ), - color: Colors.white - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + decoration: BoxDecoration( + borderRadius: BorderRadius.vertical( + top: Radius.circular(23.w) + ), + color: Colors.white + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - widget.userData.nickName, - style: TextStyle( - fontSize: 19.w, - color: const Color.fromRGBO(51, 51, 51, 1), - fontWeight: FontWeight.w600 - ), - ), - SizedBox(width: 13.w,), - if(userData.value?.genderCode == 0) Container( - width: 33.w, - height: 13.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(13.w)), - color: const Color.fromRGBO(255, 237, 255, 1) - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - Assets.imagesFemale, - width: 8.w, - height: 8.w, + Row( + children: [ + Text( + controller.userData.value.nickName ?? "", + style: TextStyle( + fontSize: 19.w, + color: const Color.fromRGBO(51, 51, 51, 1), + fontWeight: FontWeight.w600 ), - SizedBox(width: 2.w,), - Text( - "${widget.userData.age}", - style: TextStyle( - fontSize: 9.w, - color: const Color.fromRGBO(255, 66, 236, 1) + ), + SizedBox(width: 13.w,), + if(controller.myUserData.value?.genderCode == 0) Container( + width: 33.w, + height: 13.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(13.w)), + color: const Color.fromRGBO(255, 237, 255, 1) + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + Assets.imagesFemale, + width: 8.w, + height: 8.w, + ), + SizedBox(width: 2.w,), + Text( + "${controller.userData.value.age}", + style: TextStyle( + fontSize: 9.w, + color: const Color.fromRGBO(255, 66, 236, 1) + ), + ) + ], + ), + ), + SizedBox(width: 3.w,), + Container( + width: 33.w, + height: 13.w, + margin: EdgeInsets.only(right: 2.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(13.w)), + color: const Color.fromRGBO(234, 255, 219, 1) + ), + child: Center( + child: Text( + "在线", + style: TextStyle( + fontSize: 9.w, + color: const Color.fromRGBO(38, 199, 124, 1) + ), ), - ) - ], - ), - ), - SizedBox(width: 3.w,), - Container( - width: 33.w, - height: 13.w, - margin: EdgeInsets.only(right: 2.w), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(13.w)), - color: const Color.fromRGBO(234, 255, 219, 1) - ), - child: Center( - child: Text( - "在线", - style: TextStyle( - fontSize: 9.w, - color: const Color.fromRGBO(38, 199, 124, 1) ), ), - ), + SizedBox(width: 4.w,), + if (controller.userData.value.identityCard != "" && controller.userData.value.identityCard != null) Container( + width: 43.w, + height: 13.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(13.w)), + color: const Color.fromRGBO(246, 237, 255, 1) + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + Assets.imagesRealName, + width: 8.w, + height: 7.w, + ), + SizedBox(width: 2.w,), + Text( + "实名", + style: TextStyle( + fontSize: 9.w, + color: const Color.fromRGBO(160, 92, 255, 1) + ), + ) + ], + ), + ), + SizedBox(width: 4.w,), + if(controller.myUserData.value?.genderCode == 1) Container( + width: 33.w, + height: 13.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(13.w)), + color: const Color.fromRGBO(237, 245, 255, 1) + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + Assets.imagesMale, + width: 8.w, + height: 8.w, + ), + SizedBox(width: 2.w,), + Text( + "${controller.userData.value.age}", + style: TextStyle( + fontSize: 9.w, + color: const Color.fromRGBO(120, 140, 255, 1) + ), + ) + ], + ), + ), + ], ), - SizedBox(width: 4.w,), - if (widget.userData.isRealNameCertified) Container( - width: 43.w, - height: 13.w, + Container( + width: 63.w, + height: 27.w, decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(13.w)), - color: const Color.fromRGBO(246, 237, 255, 1) + borderRadius: BorderRadius.all(Radius.circular(27.w)), + color: const Color.fromRGBO(117, 98, 249, .1) ), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Image.asset( - Assets.imagesRealName, - width: 8.w, - height: 7.w, + Assets.imagesPlayer, + width: 15.w, + height: 15.w, ), - SizedBox(width: 2.w,), - Text( - "实名", - style: TextStyle( - fontSize: 9.w, - color: const Color.fromRGBO(160, 92, 255, 1) - ), - ) - ], - ), - ), - SizedBox(width: 4.w,), - if(userData.value?.genderCode == 1) Container( - width: 33.w, - height: 13.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(13.w)), - color: const Color.fromRGBO(237, 245, 255, 1) - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ + SizedBox(width: 4.w,), Image.asset( - Assets.imagesMale, - width: 8.w, - height: 8.w, + Assets.imagesVoice, + width: 15.w, + height: 13.w, ), - SizedBox(width: 2.w,), + SizedBox(width: 4.w,), Text( - "${widget.userData.age}", + "6'", style: TextStyle( - fontSize: 9.w, - color: const Color.fromRGBO(120, 140, 255, 1) + fontSize: 11.w, + color: const Color.fromRGBO(117, 98, 249, 1) ), ) ], ), - ), + ) ], ), - Container( - width: 63.w, - height: 27.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(27.w)), - color: const Color.fromRGBO(117, 98, 249, .1) + SizedBox(height: 8.w,), + Text( + "父母催婚找个结婚的", + style: TextStyle( + fontSize: 11.w, + color: const Color.fromRGBO(144, 144, 144, 1) ), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - Assets.imagesPlayer, - width: 15.w, - height: 15.w, - ), - SizedBox(width: 4.w,), - Image.asset( - Assets.imagesVoice, - width: 15.w, - height: 13.w, - ), - SizedBox(width: 4.w,), - Text( - "6'", - style: TextStyle( - fontSize: 11.w, - color: const Color.fromRGBO(117, 98, 249, 1) - ), - ) - ], + ), + SizedBox(height: 11.w,), + Wrap( + spacing: 7.w, + runSpacing: 7.w, + children: [ + ...controller.tagList.map((e){ + return TagItem(label: e); + }), + ], + ), + SizedBox(height: 16.w,), + if ((controller.userData.value.provinceName?.isNotEmpty ?? false)) Text( + "IP属地:${controller.userData.value.provinceName}", + style: TextStyle( + fontSize: 9.w, + color: const Color.fromRGBO(144, 144, 144, 1) ), - ) - ], - ), - SizedBox(height: 8.w,), - Text( - "父母催婚找个结婚的", - style: TextStyle( - fontSize: 11.w, - color: const Color.fromRGBO(144, 144, 144, 1) - ), - ), - SizedBox(height: 11.w,), - Wrap( - spacing: 7.w, - runSpacing: 7.w, - children: [ - ...tagList.map((e){ - return TagItem(label: e); - }), - ], - ), - SizedBox(height: 16.w,), - if (widget.userData.provinceName.isNotEmpty) Text( - "IP属地:${widget.userData.provinceName}", - style: TextStyle( - fontSize: 9.w, - color: const Color.fromRGBO(144, 144, 144, 1) - ), - ), - Text( - "动我ID:${widget.userData.userId}", - style: TextStyle( - fontSize: 9.w, - color: const Color.fromRGBO(144, 144, 144, 1) - ), - ), - Spacer(), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - InkWell( - onTap: () { - // 跳转到聊天页面,传递用户ID和用户数据模型 - Get.to(() => ChatPage( - userId: widget.userData.userId, - userData: widget.userData, - )); - }, - child: Container( - width: 246.w, - height: 38.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(38.w)), - color: const Color.fromRGBO(51, 51, 51, 1) - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - Assets.imagesChatBtn, - width: 13.w, - height: 12.w, + ), + Text( + "动我ID:${controller.userData.value.userId}", + style: TextStyle( + fontSize: 9.w, + color: const Color.fromRGBO(144, 144, 144, 1) + ), + ), + Spacer(), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + InkWell( + onTap: () { + // 跳转到聊天页面,传递用户ID和用户数据模型 + // Get.to(() => ChatPage( + // userId: userId, + // userData: controller.userData.value, + // )); + }, + child: Container( + width: 246.w, + height: 38.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(38.w)), + color: const Color.fromRGBO(51, 51, 51, 1) ), - SizedBox(width: 4.w,), - Text( - "发消息", + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + Assets.imagesChatBtn, + width: 13.w, + height: 12.w, + ), + SizedBox(width: 4.w,), + Text( + "发消息", + style: TextStyle( + fontSize: 15.w, + color: Colors.white, + fontWeight: FontWeight.w500 + ), + ) + ], + ), + ), + ), + Container( + width: 81.w, + height: 38.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(38.w)), + color: const Color.fromRGBO(117, 98, 249, 1) + ), + child: Center( + child: Text( + "关注", style: TextStyle( fontSize: 15.w, color: Colors.white, fontWeight: FontWeight.w500 ), - ) - ], + ), + ), ), - ), - ), - Container( - width: 81.w, - height: 38.w, + ], + ) + ], + ), + ), + ), + ), + Positioned( + left: 0, + top: MediaQuery.of(context).padding.top + 23, + + child: Container( + width: 375.w, + padding: EdgeInsets.symmetric(horizontal: 19.w), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + InkWell( + onTap: (){ + Get.back(); + }, + child: Container( + width: 31.w, + height: 31.w, decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(38.w)), - color: const Color.fromRGBO(117, 98, 249, 1) + borderRadius: BorderRadius.all(Radius.circular(31.w)), + color: const Color.fromRGBO(51, 51, 51, .5) ), child: Center( - child: Text( - "关注", - style: TextStyle( - fontSize: 15.w, - color: Colors.white, - fontWeight: FontWeight.w500 - ), + child: Icon( + Icons.keyboard_arrow_left, + size: 23.w, + color: Colors.white, ), ), ), - ], - ) - ], - ), - ), - ), - ), - Positioned( - left: 0, - top: MediaQuery.of(context).padding.top + 23, - - child: Container( - width: 375.w, - padding: EdgeInsets.symmetric(horizontal: 19.w), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - InkWell( - onTap: (){ - Get.back(); - }, - child: Container( - width: 31.w, - height: 31.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(31.w)), - color: const Color.fromRGBO(51, 51, 51, .5) ), - child: Center( - child: Icon( - Icons.keyboard_arrow_left, - size: 23.w, - color: Colors.white, - ), + PopupMenuButton( + tooltip: "", + padding: EdgeInsets.zero, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)), + color: Colors.white, + elevation: 8, + offset: Offset(0, 32.w), // 相对按钮下移一点 + itemBuilder: (context) => [ + const PopupMenuItem(value: 'report', child: Text('举报')), + const PopupMenuItem(value: 'block', child: Text('拉黑')), + ], + onSelected: (v) { + if (v == 'report') { + print("举报"); + Get.to(() => ReportPage()); + } else if (v == 'block') { + print("拉黑"); + } + }, + child: Container( + width: 31.w, + height: 31.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(62.w)), + color: const Color.fromRGBO(51, 51, 51, .5) + ), + child: Center( + child: Icon( + Icons.keyboard_control, + size: 23.w, + color: Colors.white, + ), + ), + ), // 你的小圆按钮 ), - ), - ), - PopupMenuButton( - tooltip: "", - padding: EdgeInsets.zero, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)), - color: Colors.white, - elevation: 8, - offset: Offset(0, 32.w), // 相对按钮下移一点 - itemBuilder: (context) => [ - const PopupMenuItem(value: 'report', child: Text('举报')), - const PopupMenuItem(value: 'block', child: Text('拉黑')), ], - onSelected: (v) { - if (v == 'report') { - print("举报"); - Get.to(() => ReportPage()); - } else if (v == 'block') { - print("拉黑"); - } - }, - child: Container( - width: 31.w, - height: 31.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(62.w)), - color: const Color.fromRGBO(51, 51, 51, .5) - ), - child: Center( - child: Icon( - Icons.keyboard_control, - size: 23.w, - color: Colors.white, - ), - ), - ), // 你的小圆按钮 ), - ], + ), ), - ), - ), - Positioned( - left: 15.w, - top: 310.w, - width: 345.w, - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Row( - children: [ - ...widget.userData.photoList.asMap().entries.map((entry){ - return Container( - margin: EdgeInsets.only(right: 7.w), - child: InkWell( - onTap: (){ - nowSelect = entry.key; - setState(() { - - }); - }, - child: ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(7.w)), - child: Container( - width: 40.w, - height: 40.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(7.w)), - border: nowSelect == entry.key ? Border.all(width: 2.w, color: Colors.white) : null - ), - child: Center( - child: CachedNetworkImage( - imageUrl: "${entry.value.photoUrl}?x-oss-process=image/format,webp/resize,w_76", - width: 38.w, - height: 38.w, - fit: BoxFit.cover, + Positioned( + left: 15.w, + top: 310.w, + width: 345.w, + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + children: [ + ...controller.userData.value.photoList!.asMap().entries.map((entry){ + return Container( + margin: EdgeInsets.only(right: 7.w), + child: InkWell( + onTap: (){ + controller.nowSelect.value = entry.key; + }, + child: ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(7.w)), + child: Container( + width: 40.w, + height: 40.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(7.w)), + border: controller.nowSelect.value == entry.key ? Border.all(width: 2.w, color: Colors.white) : null + ), + child: Center( + child: CachedNetworkImage( + imageUrl: "${entry.value.photoUrl}?x-oss-process=image/format,webp/resize,w_76", + width: 38.w, + height: 38.w, + fit: BoxFit.cover, + ), + ), ), ), ), - ), - ), - ); - }), - ], + ); + }), + ], + ), + ), ), - ), + ], ), - ], - ), + ) : SizedBox(); + }, ); } } + class TagItem extends StatelessWidget { final String label; const TagItem({super.key, required this.label}); diff --git a/lib/pages/mine/edit_info_page.dart b/lib/pages/mine/edit_info_page.dart index f970f99..a84c17e 100644 --- a/lib/pages/mine/edit_info_page.dart +++ b/lib/pages/mine/edit_info_page.dart @@ -82,6 +82,93 @@ class _EditInfoPageState extends State { ); } + // 显示日期选择器 + Future _showDatePicker(EditInfoController controller) async { + // 计算最小和最大日期 + final now = DateTime.now(); + final maxDate = DateTime(now.year - 18); // 最小18岁 + final minDate = DateTime(now.year - 80); // 最大80岁 + + // 初始选择日期(默认为25岁) + DateTime initialDate = DateTime(now.year - 25); + if (controller.birthday.value.isNotEmpty) { + try { + final List dateParts = controller.birthday.value.split('-'); + if (dateParts.length == 3) { + initialDate = DateTime( + int.parse(dateParts[0]), + int.parse(dateParts[1]), + int.parse(dateParts[2]), + ); + // 确保初始日期在有效范围内 + if (initialDate.isBefore(minDate)) initialDate = minDate; + if (initialDate.isAfter(maxDate)) initialDate = maxDate; + } + } catch (e) { + print('解析日期失败: $e'); + } + } + + // 临时存储选择的日期 + DateTime? selectedDate = initialDate; + + await showCupertinoModalPopup( + context: Get.context!, + builder: (BuildContext context) { + return Container( + height: 300, + color: CupertinoColors.white, + child: Column( + children: [ + // 头部按钮区域 + Container( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + CupertinoButton( + child: const Text('取消'), + onPressed: () { + Navigator.pop(context); + }, + ), + CupertinoButton( + child: const Text('确定'), + onPressed: () { + Navigator.pop(context); + if (selectedDate != null) { + // 格式化为YYYY-MM-DD + final formattedDate = '${selectedDate!.year}-' + '${selectedDate!.month.toString().padLeft(2, '0')}-' + '${selectedDate!.day.toString().padLeft(2, '0')}'; + controller.selectBirthday(formattedDate); + } + }, + ), + ], + ), + ), + // 日期选择器 + Expanded( + child: CupertinoDatePicker( + mode: CupertinoDatePickerMode.date, + initialDateTime: initialDate, + minimumDate: minDate, + maximumDate: maxDate, + onDateTimeChanged: (DateTime dateTime) { + selectedDate = dateTime; + }, + use24hFormat: true, + backgroundColor: CupertinoColors.white, + ), + ), + ], + ), + ); + }, + ); + } + @override Widget build(BuildContext context) { return GetX( @@ -251,7 +338,7 @@ class _EditInfoPageState extends State { fit: BoxFit.cover, ), ), - if(controller.userData.value!.photoList![entry.key].auditStatus == 1 || controller.userData.value!.photoList![entry.key].auditStatus == null)Positioned( + if(controller.userData.value!.photoList!.isNotEmpty && controller.userData.value!.photoList!.length >= entry.key && (controller.userData.value!.photoList![entry.key].auditStatus == 1 || controller.userData.value!.photoList![entry.key].auditStatus == null))Positioned( right: 5.w, top: 5.w, child: Container( @@ -269,7 +356,7 @@ class _EditInfoPageState extends State { controller.imgList.removeAt(entry.key); }), ), - if(controller.userData.value!.photoList![entry.key].auditStatus == 0)Positioned( + if(controller.userData.value!.photoList!.isNotEmpty && controller.userData.value!.photoList!.length >= entry.key && controller.userData.value!.photoList![entry.key].auditStatus == 0)Positioned( top: 0, right: 0, child: Container( @@ -422,11 +509,11 @@ class _EditInfoPageState extends State { Row( children: [ Text( - "${controller.userData.value?.birthDate ?? ""}", + "${controller.birthday.value != "" ? controller.birthday.value : (controller.userData.value?.birthDate != null && controller.userData.value?.birthDate != "") ? controller.userData.value?.birthDate : "请选择"}", style: TextStyle( fontSize: 13.w, - fontWeight: FontWeight.w500, - color: const Color.fromRGBO(51, 51, 51, 1) + fontWeight: (controller.birthday.value != "" && controller.userData.value?.birthDate != null && controller.userData.value?.birthDate != "") ? FontWeight.w500 : null, + color: (controller.birthday.value != "" && controller.userData.value?.birthDate != null && controller.userData.value?.birthDate != "") ? const Color.fromRGBO(51, 51, 51, 1) : const Color.fromRGBO(191, 191, 191, 1) ), ), SizedBox(width: 15.w,), @@ -438,7 +525,9 @@ class _EditInfoPageState extends State { ], ) ], - ), + ).onTap((){ + _showDatePicker(controller); + }), ], ), ), diff --git a/lib/pages/mine/my_wallet_page.dart b/lib/pages/mine/my_wallet_page.dart index ba22618..7e009ea 100644 --- a/lib/pages/mine/my_wallet_page.dart +++ b/lib/pages/mine/my_wallet_page.dart @@ -58,249 +58,254 @@ class MyWalletPage extends StatelessWidget { controller.getHistoryList(); }, child: SingleChildScrollView( - child: Column( - children: [ - Container( - height: 44.w, - margin: EdgeInsets.only( - top: 9.w, - bottom: 16.w - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 72.w, - height: 44.w, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 1, - color: Color.fromRGBO(117, 98, 249, controller.timeActive.value == 1 ? 1 : 0) - ) - ) - ), - child: Center( - child: Text( - "最近一个月", - style: TextStyle( - fontSize: 14.w, - color: Color.fromRGBO(51, 51, 51, controller.timeActive.value == 1 ? 1 : .5), - fontWeight: controller.timeActive.value == 1 ? FontWeight.w700 : FontWeight.w400 + child: ConstrainedBox( + constraints: BoxConstraints( + minHeight: MediaQuery.of(context).size.height - MediaQuery.of(context).padding.top, + ), + child: Column( + children: [ + Container( + height: 44.w, + margin: EdgeInsets.only( + top: 9.w, + bottom: 16.w + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + width: 72.w, + height: 44.w, + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + width: 1, + color: Color.fromRGBO(117, 98, 249, controller.timeActive.value == 1 ? 1 : 0) + ) + ) + ), + child: Center( + child: Text( + "最近一个月", + style: TextStyle( + fontSize: 14.w, + color: Color.fromRGBO(51, 51, 51, controller.timeActive.value == 1 ? 1 : .5), + fontWeight: controller.timeActive.value == 1 ? FontWeight.w700 : FontWeight.w400 + ), ), ), - ), - ).onTap(() async { - controller.timeActive.value = 1; - controller.page.value = 1; - controller.walletHistoryList.clear(); - await controller.getHistoryList(); - controller.listRefreshController.finishRefresh(IndicatorResult.success); - controller.listRefreshController.finishLoad(IndicatorResult.none); - }), - Container( - width: 72.w, - height: 44.w, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 1, - color: Color.fromRGBO(117, 98, 249, controller.timeActive.value == 2 ? 1 : 0) - ) - ) - ), - child: Center( - child: Text( - "3个月", - style: TextStyle( - fontSize: 14.w, - color: Color.fromRGBO(51, 51, 51, controller.timeActive.value == 2 ? 1 : .5), - fontWeight: controller.timeActive.value == 2 ? FontWeight.w700 : FontWeight.w400 + ).onTap(() async { + controller.timeActive.value = 1; + controller.page.value = 1; + controller.walletHistoryList.clear(); + await controller.getHistoryList(); + controller.listRefreshController.finishRefresh(IndicatorResult.success); + controller.listRefreshController.finishLoad(IndicatorResult.none); + }), + Container( + width: 72.w, + height: 44.w, + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + width: 1, + color: Color.fromRGBO(117, 98, 249, controller.timeActive.value == 2 ? 1 : 0) + ) + ) + ), + child: Center( + child: Text( + "3个月", + style: TextStyle( + fontSize: 14.w, + color: Color.fromRGBO(51, 51, 51, controller.timeActive.value == 2 ? 1 : .5), + fontWeight: controller.timeActive.value == 2 ? FontWeight.w700 : FontWeight.w400 + ), ), ), - ), - ).onTap(() async { - controller.timeActive.value = 2; - controller.page.value = 1; - controller.walletHistoryList.clear(); - await controller.getHistoryList(); - controller.listRefreshController.finishRefresh(IndicatorResult.success); - controller.listRefreshController.finishLoad(IndicatorResult.none); - }), - Container( - width: 72.w, - height: 44.w, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 1, - color: Color.fromRGBO(117, 98, 249, controller.timeActive.value == 3 ? 1 : 0) - ) - ) - ), - child: Center( - child: Text( - "6个月", - style: TextStyle( - fontSize: 14.w, - color: Color.fromRGBO(51, 51, 51, controller.timeActive.value == 13 ? 1 : .5), - fontWeight: controller.timeActive.value == 3 ? FontWeight.w700 : FontWeight.w400 + ).onTap(() async { + controller.timeActive.value = 2; + controller.page.value = 1; + controller.walletHistoryList.clear(); + await controller.getHistoryList(); + controller.listRefreshController.finishRefresh(IndicatorResult.success); + controller.listRefreshController.finishLoad(IndicatorResult.none); + }), + Container( + width: 72.w, + height: 44.w, + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + width: 1, + color: Color.fromRGBO(117, 98, 249, controller.timeActive.value == 3 ? 1 : 0) + ) + ) + ), + child: Center( + child: Text( + "6个月", + style: TextStyle( + fontSize: 14.w, + color: Color.fromRGBO(51, 51, 51, controller.timeActive.value == 13 ? 1 : .5), + fontWeight: controller.timeActive.value == 3 ? FontWeight.w700 : FontWeight.w400 + ), ), ), - ), - ).onTap(() async { - controller.timeActive.value = 3; - controller.page.value = 1; - controller.walletHistoryList.clear(); - await controller.getHistoryList(); - controller.listRefreshController.finishRefresh(IndicatorResult.success); - controller.listRefreshController.finishLoad(IndicatorResult.none); - }), - Container( - width: 72.w, - height: 44.w, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 1, - color: Color.fromRGBO(117, 98, 249, controller.timeActive.value == 4 ? 1 : 0) - ) - ) - ), - child: Center( - child: Text( - "全部", - style: TextStyle( - fontSize: 14.w, - color: Color.fromRGBO(51, 51, 51, controller.timeActive.value == 4 ? 1 : .5), - fontWeight: controller.timeActive.value == 4 ? FontWeight.w700 : FontWeight.w400 + ).onTap(() async { + controller.timeActive.value = 3; + controller.page.value = 1; + controller.walletHistoryList.clear(); + await controller.getHistoryList(); + controller.listRefreshController.finishRefresh(IndicatorResult.success); + controller.listRefreshController.finishLoad(IndicatorResult.none); + }), + Container( + width: 72.w, + height: 44.w, + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + width: 1, + color: Color.fromRGBO(117, 98, 249, controller.timeActive.value == 4 ? 1 : 0) + ) + ) + ), + child: Center( + child: Text( + "全部", + style: TextStyle( + fontSize: 14.w, + color: Color.fromRGBO(51, 51, 51, controller.timeActive.value == 4 ? 1 : .5), + fontWeight: controller.timeActive.value == 4 ? FontWeight.w700 : FontWeight.w400 + ), ), ), - ), - ).onTap(() async { - controller.timeActive.value = 4; - controller.page.value = 1; - controller.walletHistoryList.clear(); - await controller.getHistoryList(); - controller.listRefreshController.finishRefresh(IndicatorResult.success); - controller.listRefreshController.finishLoad(IndicatorResult.none); - }), - ], - ), - ), - Container( - width: 355.w, - height: 129.w, - margin: EdgeInsets.only( - bottom: 24.w - ), - padding: EdgeInsets.symmetric( - vertical: 12.w + ).onTap(() async { + controller.timeActive.value = 4; + controller.page.value = 1; + controller.walletHistoryList.clear(); + await controller.getHistoryList(); + controller.listRefreshController.finishRefresh(IndicatorResult.success); + controller.listRefreshController.finishLoad(IndicatorResult.none); + }), + ], + ), ), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(10.w)), - color: const Color.fromRGBO(247, 247, 247, 1) - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - width: 255.w, - padding: EdgeInsets.symmetric( - horizontal: 16.w - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "${controller.walletData.value.totalBalance ?? ""}", - style: TextStyle( - fontSize: 20.w, - fontWeight: FontWeight.w500 - ), - ), - SizedBox(height: 6.w,), - Text( - "总余额(元)", - style: TextStyle( - fontSize: 13.w, - color: const Color.fromRGBO(102, 102, 102, 1) - ), - ) - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "${controller.walletData.value.settlementBalance ?? ""}", - style: TextStyle( - fontSize: 20.w, - fontWeight: FontWeight.w500, - color: const Color.fromRGBO(117, 98, 249, 1) + Container( + width: 355.w, + height: 129.w, + margin: EdgeInsets.only( + bottom: 24.w + ), + padding: EdgeInsets.symmetric( + vertical: 12.w + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(10.w)), + color: const Color.fromRGBO(247, 247, 247, 1) + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + width: 255.w, + padding: EdgeInsets.symmetric( + horizontal: 16.w + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "${controller.walletData.value.totalBalance ?? ""}", + style: TextStyle( + fontSize: 20.w, + fontWeight: FontWeight.w500 + ), ), - ), - SizedBox(height: 6.w,), - Text( - "结算中金额(元)", - style: TextStyle( - fontSize: 13.w, - color: const Color.fromRGBO(102, 102, 102, 1) + SizedBox(height: 6.w,), + Text( + "总余额(元)", + style: TextStyle( + fontSize: 13.w, + color: const Color.fromRGBO(102, 102, 102, 1) + ), + ) + ], + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "${controller.walletData.value.settlementBalance ?? ""}", + style: TextStyle( + fontSize: 20.w, + fontWeight: FontWeight.w500, + color: const Color.fromRGBO(117, 98, 249, 1) + ), ), - ) - ], - ), - ], - ), - ), - Container( - width: 255.w, - height: 42.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(42.w)), - color: const Color.fromRGBO(117, 98, 249, 1) + SizedBox(height: 6.w,), + Text( + "结算中金额(元)", + style: TextStyle( + fontSize: 13.w, + color: const Color.fromRGBO(102, 102, 102, 1) + ), + ) + ], + ), + ], + ), ), - child: Center( - child: Text( - "提现", - style: TextStyle( - fontSize: 14.w, - fontWeight: FontWeight.w500, - color: Colors.white + Container( + width: 255.w, + height: 42.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(42.w)), + color: const Color.fromRGBO(117, 98, 249, 1) + ), + child: Center( + child: Text( + "提现", + style: TextStyle( + fontSize: 14.w, + fontWeight: FontWeight.w500, + color: Colors.white + ), ), ), - ), - ).onTap(() { - Get.to(() => WithdrawPage(availableWithdrawBalance: controller.walletData.value.availableWithdrawBalance ?? 0)); - }) - ], - ), - ), - Padding( - padding: EdgeInsetsGeometry.symmetric( - horizontal: 10.w + ).onTap(() { + Get.to(() => WithdrawPage(availableWithdrawBalance: controller.walletData.value.availableWithdrawBalance ?? 0)); + }) + ], + ), ), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "流水明细", - style: TextStyle( - fontSize: 13.w, - fontWeight: FontWeight.w500 - ), - ) - ], + Padding( + padding: EdgeInsetsGeometry.symmetric( + horizontal: 10.w + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "流水明细", + style: TextStyle( + fontSize: 13.w, + fontWeight: FontWeight.w500 + ), + ) + ], + ), ), - ), - SizedBox(height: 22.w,), - ...controller.walletHistoryList.map((e){ - return InfoItem(item: e,); - }), - ], + SizedBox(height: 22.w,), + ...controller.walletHistoryList.map((e){ + return InfoItem(item: e,); + }), + ], + ), ), ), ), diff --git a/lib/pages/mine/pay_fail_page.dart b/lib/pages/mine/pay_fail_page.dart index 46f876c..9f72547 100644 --- a/lib/pages/mine/pay_fail_page.dart +++ b/lib/pages/mine/pay_fail_page.dart @@ -1,4 +1,5 @@ import 'package:dating_touchme_app/components/page_appbar.dart'; +import 'package:dating_touchme_app/extension/ex_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -10,6 +11,31 @@ class PayFailPage extends StatefulWidget { } class _PayFailPageState extends State { + + int startTime = 0; + + Future f1() async { + await Future.delayed(Duration(milliseconds: 500)); + print("任务1完成,耗时${DateTime.now().millisecondsSinceEpoch - startTime}毫秒"); + print("开始时间:${startTime}"); + print("当前时间:${DateTime.now().millisecondsSinceEpoch}"); + } + + Future f2() async { + await Future.delayed(Duration(milliseconds: 500)); + print("任务2完成,耗时${DateTime.now().millisecondsSinceEpoch - startTime}毫秒"); + print("开始时间:${startTime}"); + print("当前时间:${DateTime.now().millisecondsSinceEpoch}"); + } + + Future f3() async { + await Future.delayed(Duration(milliseconds: 500)); + print("任务3完成,耗时${DateTime.now().millisecondsSinceEpoch - startTime}毫秒"); + print("开始时间:${startTime}"); + print("当前时间:${DateTime.now().millisecondsSinceEpoch}"); + } + + @override Widget build(BuildContext context) { return Scaffold( @@ -44,7 +70,13 @@ class _PayFailPageState extends State { fontSize: 13.w, fontWeight: FontWeight.w500 ), - ), + ).onTap((){ + startTime = DateTime.now().millisecondsSinceEpoch; + print("顺序写"); + f1(); + f2(); + f3(); + }), SizedBox(height: 292.w,), Container( width: 150.w, @@ -62,7 +94,15 @@ class _PayFailPageState extends State { ), ), ), - ), + ).onTap((){ + startTime = DateTime.now().millisecondsSinceEpoch; + print("Future.wait"); + Future.wait([ + f1(), + f2(), + f3(), + ]); + }), SizedBox(height: 18.w,), Text( "返回", diff --git a/lib/pages/mine/rose_history_page.dart b/lib/pages/mine/rose_history_page.dart index ce6d880..be5546d 100644 --- a/lib/pages/mine/rose_history_page.dart +++ b/lib/pages/mine/rose_history_page.dart @@ -62,76 +62,73 @@ class RoseHistoryPage extends StatelessWidget { vertical: 6.w, horizontal: 15.w ), - child: Column( - children: [ - Row( - children: [ - ...controller.friendNavList.asMap().entries.map((entry){ - return Container( - margin: EdgeInsets.only(right: 25.w), - child: InkWell( - onTap: (){ - controller.changeNavTab(entry.key); + child: ConstrainedBox( + constraints: BoxConstraints( + minHeight: MediaQuery.of(context).size.height - MediaQuery.of(context).padding.top, + ), + child: Column( + children: [ + Row( + children: [ + ...controller.friendNavList.asMap().entries.map((entry){ + return Container( + margin: EdgeInsets.only(right: 25.w), + child: InkWell( + onTap: (){ + controller.changeNavTab(entry.key); - }, - child: Container( - padding: entry.key == controller.friendNavActive.value ? EdgeInsets.symmetric(vertical: 2.w, horizontal: 26.w) : EdgeInsets.zero, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(21.w)), - color: entry.key == controller.friendNavActive.value ? const Color.fromRGBO(117, 98, 249, 1) : Colors.transparent - ), - child: Text( - entry.value, - style: TextStyle( - fontSize: 12.w, - color: entry.key == controller.friendNavActive.value ? Colors.white : const Color.fromRGBO(51, 51, 51, .7), - fontWeight: entry.key == controller.friendNavActive.value ? FontWeight.w700 : FontWeight.w500 + }, + child: Container( + padding: entry.key == controller.friendNavActive.value ? EdgeInsets.symmetric(vertical: 2.w, horizontal: 26.w) : EdgeInsets.zero, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(21.w)), + color: entry.key == controller.friendNavActive.value ? const Color.fromRGBO(117, 98, 249, 1) : Colors.transparent + ), + child: Text( + entry.value, + style: TextStyle( + fontSize: 12.w, + color: entry.key == controller.friendNavActive.value ? Colors.white : const Color.fromRGBO(51, 51, 51, .7), + fontWeight: entry.key == controller.friendNavActive.value ? FontWeight.w700 : FontWeight.w500 + ), ), ), ), - ), - ); - }), + ); + }), + ], + ), + SizedBox(height: 4.w,), + if(controller.friendNavActive.value != 2) ...[ + ...controller.roseHistoryList.map((e){ + return SendItem(item: e); + }) + ], + if(controller.friendNavActive.value == 2) ...[ + ChatCouponItem(), + ChatCouponItem(), + ChatCouponItem(), + ChatCouponItem(), + ChatCouponItem(), + ChatCouponItem(), + ChatCouponItem(), + ChatCouponItem(), + ChatCouponItem(), + ChatCouponItem(), + ChatCouponItem(), + ChatCouponItem(), + ChatCouponItem(), + ChatCouponItem(), + ChatCouponItem(), + ChatCouponItem(), + ChatCouponItem(), + ChatCouponItem(), + ChatCouponItem(), + ChatCouponItem(), ], - ), - SizedBox(height: 4.w,), - if(controller.friendNavActive.value != 2) ...[ - ...controller.roseHistoryList.map((e){ - return SendItem(item: e); - }) - ], - if(controller.friendNavActive.value == 2) ...[ - ChatCouponItem(), - ChatCouponItem(), - ChatCouponItem(), - ChatCouponItem(), - ChatCouponItem(), - ChatCouponItem(), - ChatCouponItem(), - ChatCouponItem(), - ChatCouponItem(), - ChatCouponItem(), - ChatCouponItem(), - ChatCouponItem(), - ChatCouponItem(), - ChatCouponItem(), - ChatCouponItem(), - ChatCouponItem(), - ChatCouponItem(), - ChatCouponItem(), - ChatCouponItem(), - ChatCouponItem(), ], - SizedBox(height: 6.w,), - Text( - "没有更多了", - style: TextStyle( - fontSize: 11.w, - color: const Color.fromRGBO(144, 144, 144, 1), - ), - ) - ], + ), ), ), ), diff --git a/lib/pages/mine/withdraw_history_page.dart b/lib/pages/mine/withdraw_history_page.dart index 5625f44..0caa813 100644 --- a/lib/pages/mine/withdraw_history_page.dart +++ b/lib/pages/mine/withdraw_history_page.dart @@ -58,10 +58,14 @@ class WithdrawHistoryPage extends StatelessWidget { }, child: SingleChildScrollView( child: Container( + width: 375.w, padding: EdgeInsetsGeometry.symmetric( vertical: 11.w, horizontal: 16.w ), + constraints: BoxConstraints( + minHeight: MediaQuery.of(context).size.height - MediaQuery.of(context).padding.top, + ), child: Column( children: [ ...controller.historyList.map((e){