diff --git a/lib/controller/mine/add_bankcard_controller.dart b/lib/controller/mine/add_bankcard_controller.dart new file mode 100644 index 0000000..cc3a835 --- /dev/null +++ b/lib/controller/mine/add_bankcard_controller.dart @@ -0,0 +1,220 @@ +import 'dart:io'; + +import 'package:dating_touchme_app/model/mine/bank_card_ocr_data.dart'; +import 'package:dating_touchme_app/network/user_api.dart'; +import 'package:dating_touchme_app/oss/oss_manager.dart'; +import 'package:flustars/flustars.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:get/get.dart'; +import 'package:get/get_state_manager/src/simple/get_controllers.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:permission_handler/permission_handler.dart'; + +class AddBankcardController extends GetxController { + + late UserApi _userApi; + + + final username = ''.obs; + final usernameController = TextEditingController().obs; + + final cardNum = ''.obs; + final cardNumController = TextEditingController().obs; + + final bankName = ''.obs; + final bankNameController = TextEditingController().obs; + + final openingBank = ''.obs; + final openingBankController = TextEditingController().obs; + + @override + void onInit() { + super.onInit(); + _userApi = Get.find(); + } + + // 选择头像 - 业务逻辑处理 + Future handleCameraCapture() async { + try { + // 请求相机权限 + final ok = await _ensurePermission( + Permission.camera, + denyToast: '相机权限被拒绝,请在设置中允许访问相机', + ); + if (!ok) return; + + // 请求麦克风权限(部分设备拍照/录像会一并请求建议预授权) + await _ensurePermission(Permission.microphone, denyToast: '麦克风权限被拒绝'); + + // 权限通过后拍照 + final ImagePicker picker = ImagePicker(); + final XFile? photo = await picker.pickImage(source: ImageSource.camera); + + if (photo != null) { + await processSelectedImage(File(photo.path)); + } + } catch (e) { + print('拍照失败: $e'); + // 更友好的错误提示 + if (e.toString().contains('permission') || e.toString().contains('权限')) { + SmartDialog.showToast('相机权限被拒绝,请在设置中允许访问相机'); + } else if (e.toString().contains('camera') || + e.toString().contains('相机')) { + SmartDialog.showToast('设备没有可用的相机'); + } else { + SmartDialog.showToast('拍照失败,请重试'); + } + } + } + + Future handleGallerySelection() async { + try { + // 请求相册/照片权限 + // final ok = await _ensurePermission( + // Permission.photos, + // // Android 上 photos 等价于 storage/mediaLibrary,permission_handler 会映射 + // denyToast: '相册权限被拒绝,请在设置中允许访问相册', + + // ); + // if (!ok) return; + + // 从相册选择图片 + final ImagePicker picker = ImagePicker(); + final XFile? image = await picker.pickImage(source: ImageSource.gallery); + + if (image != null) { + await processSelectedImage(File(image.path)); + } + } catch (e) { + print('选择图片失败: $e'); + // 更友好的错误提示 + if (e.toString().contains('permission') || e.toString().contains('权限')) { + SmartDialog.showToast('相册权限被拒绝,请在设置中允许访问相册'); + } else { + SmartDialog.showToast('选择图片失败,请重试'); + } + } + } + + // 通用权限申请 + Future _ensurePermission(Permission permission, {String? denyToast}) async { + var status = await permission.status; + if (status.isGranted) return true; + + if (status.isDenied || status.isRestricted || status.isLimited) { + status = await permission.request(); + if (status.isGranted) return true; + if (denyToast != null) SmartDialog.showToast(denyToast); + return false; + } + + if (status.isPermanentlyDenied) { + if (denyToast != null) SmartDialog.showToast('$denyToast,前往系统设置开启'); + // 延迟弹设置,避免与弹窗冲突 + Future.delayed(const Duration(milliseconds: 300), openAppSettings); + return false; + } + return false; + } + + + // 处理选中的图片 + Future processSelectedImage(File imageFile) 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'); + ocrBankCard(imageUrl); + // SmartDialog.dismiss(); + // SmartDialog.showToast('银行卡上传成功'); + } catch (e) { + SmartDialog.dismiss(); + print('处理图片失败: $e'); + SmartDialog.showToast('银行卡上传失败,请重试'); + } + } + + ocrBankCard(String url) async { + try { + final response = await _userApi.recognizeBankCard({ + "url":url + }); + if (response.data.isSuccess) { + + final BankCardOcrData data = response.data.data ?? BankCardOcrData(); + bankName.value = data.bankName ?? ""; + bankNameController.value.value = TextEditingValue( + text: bankName.value, + selection: TextSelection.fromPosition(TextPosition(offset: bankName.value.length)), + ); + cardNum.value = data.cardNum ?? ""; + cardNumController.value.value = TextEditingValue( + text: cardNum.value, + selection: TextSelection.fromPosition(TextPosition(offset: cardNum.value.length)), + ); + SmartDialog.dismiss(); + SmartDialog.showToast('银行卡识别成功'); + } + else{ + + SmartDialog.showToast(response.data.message); + + return; + } + } catch (e){ + print('银行卡识别失败: $e'); + SmartDialog.showToast('银行卡识别失败,请重试'); + return; + } + } + + saveCard() async { + + if(username.value == ""){ + SmartDialog.showToast('请输入持卡人姓名'); + return; + } + if(cardNum.value == ""){ + SmartDialog.showToast('请输入卡号'); + return; + } + if(bankName.value == ""){ + SmartDialog.showToast('请输入所属银行'); + return; + } + if(openingBank.value == ""){ + SmartDialog.showToast('请输入开户行'); + return; + } + + final payload = { + "ownerName": username.value, + "cardNum": cardNum.value, + "bankName": bankName.value, + "openingBank": openingBank.value, + }; + + try { + final response = await _userApi.createBankCardByIndividual(payload); + if (response.data.isSuccess) { + + SmartDialog.showToast('保存成功'); + Get.back(); + } + else{ + + SmartDialog.showToast(response.data.message); + + return; + } + } catch (e){ + print('保存失败: $e'); + SmartDialog.showToast('保存失败,请重试'); + return; + } + } + +} \ 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 c468f53..05ffc7b 100644 --- a/lib/controller/mine/edit_info_controller.dart +++ b/lib/controller/mine/edit_info_controller.dart @@ -37,8 +37,8 @@ class EditInfoController extends GetxController { final userData = GlobalData().userData.obs; - String height = ''; - final TextEditingController heightController = TextEditingController(); + final height = ''.obs; + final heightController = TextEditingController().obs; final educationList = [].obs; @@ -92,6 +92,7 @@ class EditInfoController extends GetxController { getPropertyList(); getOccupationList(); getAreaShow(); + setData(); } getEducationList() async { @@ -101,6 +102,10 @@ class EditInfoController extends GetxController { final data = response.data.data; educationList.clear(); educationList.addAll(data?.toList() ?? []); + + educationSelect.value = educationList.indexWhere((e){ + return e.value == userData.value?.educationCode; + }); } else { // 响应失败,抛出异常 throw Exception(response.data.message ?? '获取数据失败'); @@ -119,6 +124,10 @@ class EditInfoController extends GetxController { final data = response.data.data; incomeList.clear(); incomeList.addAll(data?.toList() ?? []); + + incomeSelect.value = incomeList.indexWhere((e){ + return e.value == userData.value?.incomeCode; + }); } else { // 响应失败,抛出异常 throw Exception(response.data.message ?? '获取数据失败'); @@ -137,6 +146,10 @@ class EditInfoController extends GetxController { final data = response.data.data; maritalList.clear(); maritalList.addAll(data?.toList() ?? []); + + maritalSelect.value = maritalList.indexWhere((e){ + return e.value == userData.value?.maritalStatusCode; + }); } else { // 响应失败,抛出异常 throw Exception(response.data.message ?? '获取数据失败'); @@ -155,6 +168,10 @@ class EditInfoController extends GetxController { final data = response.data.data; propertyList.clear(); propertyList.addAll(data?.toList() ?? []); + + propertySelect.value = propertyList.indexWhere((e){ + return e.value == userData.value?.propertyPermitsCode; + }); } else { // 响应失败,抛出异常 throw Exception(response.data.message ?? '获取数据失败'); @@ -178,7 +195,23 @@ class EditInfoController extends GetxController { return e.occupation; }).toList(); } - print(occupationShowData); + + final outerIndex = occupationList.indexWhere((outer) => + outer.occupationList!.any((child) => child.occupationCode == userData.value?.occupationCode)); + + if (outerIndex != -1) { + final innerIndex = occupationList[outerIndex].occupationList + !.indexWhere((child) => child.occupationCode == userData.value?.occupationCode); + + print("outerIndex = $outerIndex, innerIndex = $innerIndex"); + + occupation.value = "${occupationList[outerIndex].industry}-${occupationList[outerIndex].occupationList![innerIndex].occupation}"; + occupationValue.value = [occupationList[outerIndex].industryCode, occupationList[outerIndex].occupationList![innerIndex].occupationCode]; + + print(occupation.value); + print(occupationValue.value); + } + } else { // 响应失败,抛出异常 throw Exception(response.data.message ?? '获取数据失败'); @@ -202,6 +235,35 @@ class EditInfoController extends GetxController { print(areaShowData); } + setData(){ + imgList.value = userData.value?.photoList?.map((e){ + return e.photoUrl; + }).toList() ?? []; + height.value = userData.value?.height.toString() ?? ""; + heightController.value.value = TextEditingValue( + text: height.value, + selection: TextSelection.fromPosition(TextPosition(offset: height.value.length)), + ); + location.value = "${userData.value?.provinceName}-${userData.value?.cityName}-${userData.value?.districtName}"; + locationValue.value = [userData.value?.provinceCode, userData.value?.cityCode, userData.value?.districtCode]; + homeLocation.value = "${userData.value?.hometownProvinceName}-${userData.value?.hometownCityName}"; + locationValue.value = [userData.value?.hometownProvinceCode, userData.value?.hometownCityCode]; + } + + 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; + } // 选择头像 - 业务逻辑处理 diff --git a/lib/controller/mine/withdraw_controller.dart b/lib/controller/mine/withdraw_controller.dart new file mode 100644 index 0000000..98c7f7a --- /dev/null +++ b/lib/controller/mine/withdraw_controller.dart @@ -0,0 +1,43 @@ +import 'package:dating_touchme_app/model/mine/bank_card_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'; +import 'package:get/get_state_manager/src/simple/get_controllers.dart'; + +class WithdrawController extends GetxController { + + late UserApi _userApi; + + final money = 3880.obs; + + final bankCardList = [].obs; + + final nowBankCard = BankCardData().obs; + + @override + void onInit() { + super.onInit(); + _userApi = Get.find(); + + getBankCard(); + } + + getBankCard() async { + try{ + final response = await _userApi.listBankCardByIndividual({}); + if (response.data.isSuccess && response.data.data != null) { + final data = response.data.data; + bankCardList.clear(); + bankCardList.addAll(data?.toList() ?? []); + } else { + + // 响应失败,抛出异常 + throw Exception(response.data.message ?? '获取数据失败'); + } + } catch (e) { + print('银行卡列表获取失败: $e'); + SmartDialog.showToast('银行卡列表获取失败'); + rethrow; + } + } +} \ No newline at end of file diff --git a/lib/model/mine/bank_card_data.dart b/lib/model/mine/bank_card_data.dart new file mode 100644 index 0000000..b9b9e60 --- /dev/null +++ b/lib/model/mine/bank_card_data.dart @@ -0,0 +1,28 @@ +class BankCardData { + String? id; + String? ownerName; + String? bankName; + String? cardNum; + String? openingBank; + + BankCardData( + {this.id, this.ownerName, this.bankName, this.cardNum, this.openingBank}); + + BankCardData.fromJson(Map json) { + id = json['id']; + ownerName = json['ownerName']; + bankName = json['bankName']; + cardNum = json['cardNum']; + openingBank = json['openingBank']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['ownerName'] = this.ownerName; + data['bankName'] = this.bankName; + data['cardNum'] = this.cardNum; + data['openingBank'] = this.openingBank; + return data; + } +} diff --git a/lib/model/mine/bank_card_ocr_data.dart b/lib/model/mine/bank_card_ocr_data.dart new file mode 100644 index 0000000..2881aee --- /dev/null +++ b/lib/model/mine/bank_card_ocr_data.dart @@ -0,0 +1,18 @@ +class BankCardOcrData { + String? bankName; + String? cardNum; + + BankCardOcrData({this.bankName, this.cardNum}); + + BankCardOcrData.fromJson(Map json) { + bankName = json['bankName']; + cardNum = json['cardNum']; + } + + Map toJson() { + final Map data = new Map(); + data['bankName'] = this.bankName; + data['cardNum'] = this.cardNum; + return data; + } +} diff --git a/lib/model/mine/user_data.dart b/lib/model/mine/user_data.dart index d0cdd1c..bb35567 100644 --- a/lib/model/mine/user_data.dart +++ b/lib/model/mine/user_data.dart @@ -1,4 +1,6 @@ // 用户详细信息实体类 +import 'package:dating_touchme_app/model/home/marriage_data.dart'; + class UserData { String? id; String? nickName; @@ -62,6 +64,7 @@ class UserData { String? phone; String? realName; bool? matchmakerFlag; + List? photoList; UserData({ this.id, @@ -126,6 +129,7 @@ class UserData { this.phone, this.realName, this.matchmakerFlag, + this.photoList, }); // 从JSON映射创建实例 @@ -190,6 +194,7 @@ class UserData { hometownProvinceName: json['hometownProvinceName'], hometownCityCode: json['hometownCityCode'], hometownCityName: json['hometownCityName'], + photoList: (json['photoList'] as List?)?.map((e) => PhotoItem.fromJson(e as Map)).toList() ?? [], ); } @@ -255,11 +260,12 @@ class UserData { 'hometownProvinceName': hometownProvinceName, 'hometownCityCode': hometownCityCode, 'hometownCityName': hometownCityName, + 'photoList': photoList, }; } @override String toString() { - return 'UserData(id: $id, nickName: $nickName, genderCode: $genderCode, genderValue: $genderValue, birthYear: $birthYear)'; + return 'UserData(id: $id, nickName: $nickName, genderCode: $genderCode, genderValue: $genderValue, birthYear: $birthYear, photoList: $photoList)'; } } \ No newline at end of file diff --git a/lib/network/api_urls.dart b/lib/network/api_urls.dart index ea4e69b..3447f70 100644 --- a/lib/network/api_urls.dart +++ b/lib/network/api_urls.dart @@ -27,6 +27,9 @@ class ApiUrls { static const String createRtcChannel = 'dating-agency-chat-audio/user/create/rtc-channel'; static const String editOwnMarriageInformation = 'dating-agency-service/user/edit/own-marriage-information'; static const String getSwRtmToken = 'dating-agency-chat-audio/user/get/sw/rtm/token'; + static const String listBankCardByIndividual = 'dating-agency-mall/user/list/bank-card/by-individual'; + static const String createBankCardByIndividual = 'dating-agency-mall/user/create/bank-card/by-individual'; + static const String recognizeBankCard = 'dating-agency-uec/user/recognize/bank-card'; //首页相关接口 static const String getMarriageList = 'dating-agency-service/user/page/dongwo/marriage-information'; diff --git a/lib/network/user_api.dart b/lib/network/user_api.dart index c697833..e27bfe6 100644 --- a/lib/network/user_api.dart +++ b/lib/network/user_api.dart @@ -1,4 +1,6 @@ import 'package:dating_touchme_app/model/common/oss_data.dart'; +import 'package:dating_touchme_app/model/mine/bank_card_data.dart'; +import 'package:dating_touchme_app/model/mine/bank_card_ocr_data.dart'; import 'package:dating_touchme_app/model/mine/education_data.dart'; import 'package:dating_touchme_app/model/mine/login_data.dart'; import 'package:dating_touchme_app/model/mine/occupation_data.dart'; @@ -116,4 +118,19 @@ abstract class UserApi { Future>> editOwnMarriageInformation( @Body() Map data, ); + + @GET(ApiUrls.listBankCardByIndividual) + Future>>> listBankCardByIndividual( + @Body() Map data, + ); + + @POST(ApiUrls.createBankCardByIndividual) + Future>> createBankCardByIndividual( + @Body() Map data, + ); + + @POST(ApiUrls.recognizeBankCard) + Future>> recognizeBankCard( + @Body() Map data, + ); } diff --git a/lib/network/user_api.g.dart b/lib/network/user_api.g.dart index c3b10f7..f190f93 100644 --- a/lib/network/user_api.g.dart +++ b/lib/network/user_api.g.dart @@ -188,8 +188,8 @@ class _UserApi implements UserApi { @override Future>> saveCertificationAudit( - Map data, - ) async { + Map data, + ) async { final _extra = {}; final queryParameters = {}; final _headers = {}; @@ -198,11 +198,11 @@ class _UserApi implements UserApi { final _options = _setStreamType>>( Options(method: 'POST', headers: _headers, extra: _extra) .compose( - _dio.options, - 'dating-agency-service/user/save/certification/audit', - queryParameters: queryParameters, - data: _data, - ) + _dio.options, + 'dating-agency-service/user/save/certification/audit', + queryParameters: queryParameters, + data: _data, + ) .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), ); final _result = await _dio.fetch>(_options); @@ -210,7 +210,7 @@ class _UserApi implements UserApi { try { _value = BaseResponse.fromJson( _result.data!, - (json) => json as dynamic, + (json) => json as dynamic, ); } on Object catch (e, s) { errorLogger?.logError(e, s, _options); @@ -761,6 +761,119 @@ class _UserApi implements UserApi { return httpResponse; } + @override + Future>>> + listBankCardByIndividual(Map data) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(data); + final _options = + _setStreamType>>>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + 'dating-agency-mall/user/list/bank-card/by-individual', + 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) => json is List + ? json + .map( + (i) => BankCardData.fromJson(i as Map), + ) + .toList() + : List.empty(), + ); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future>> createBankCardByIndividual( + Map data, + ) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(data); + final _options = _setStreamType>>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + 'dating-agency-mall/user/create/bank-card/by-individual', + 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) => json as dynamic, + ); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future>> recognizeBankCard( + Map data, + ) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(data); + final _options = + _setStreamType>>( + Options(method: 'POST', headers: _headers, extra: _extra) + .compose( + _dio.options, + 'dating-agency-uec/user/recognize/bank-card', + 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) => BankCardOcrData.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/user_information_page.dart b/lib/pages/home/user_information_page.dart index 7b3a79d..ee8e7fb 100644 --- a/lib/pages/home/user_information_page.dart +++ b/lib/pages/home/user_information_page.dart @@ -1,3 +1,4 @@ +import 'package:dating_touchme_app/controller/global.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'; @@ -30,6 +31,25 @@ class _UserInformationPageState extends State { "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 Widget build(BuildContext context) { return Scaffold( @@ -80,7 +100,7 @@ class _UserInformationPageState extends State { ), ), SizedBox(width: 13.w,), - Container( + if(userData.value?.genderCode == 0) Container( width: 33.w, height: 13.w, decoration: BoxDecoration( @@ -153,7 +173,7 @@ class _UserInformationPageState extends State { ), ), SizedBox(width: 4.w,), - Container( + if(userData.value?.genderCode == 1) Container( width: 33.w, height: 13.w, decoration: BoxDecoration( diff --git a/lib/pages/mine/add_bankcard_page.dart b/lib/pages/mine/add_bankcard_page.dart index 715ecc0..51cb580 100644 --- a/lib/pages/mine/add_bankcard_page.dart +++ b/lib/pages/mine/add_bankcard_page.dart @@ -1,256 +1,270 @@ import 'package:dating_touchme_app/components/page_appbar.dart'; +import 'package:dating_touchme_app/controller/mine/add_bankcard_controller.dart'; import 'package:dating_touchme_app/extension/ex_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -class AddBankcardPage extends StatefulWidget { +class AddBankcardPage extends StatelessWidget { const AddBankcardPage({super.key}); - @override - State createState() => _AddBankcardPageState(); -} - -class _AddBankcardPageState extends State { + // 显示头像选择选项 + void _showAvatarOptions(AddBankcardController controller) { + showCupertinoModalPopup( + context: Get.context!, + builder: (context) => CupertinoActionSheet( + title: const Text('上传银行卡'), + actions: [ + CupertinoActionSheetAction( + child: const Text('拍照'), + onPressed: () async { + Navigator.pop(context); + await controller.handleCameraCapture(); + }, + ), + CupertinoActionSheetAction( + child: const Text('从相册选择'), + onPressed: () async { + Navigator.pop(context); + await controller.handleGallerySelection(); + }, + ), + ], + cancelButton: CupertinoActionSheetAction( + child: const Text('取消'), + isDestructiveAction: true, + onPressed: () { + Navigator.pop(context); + }, + ), + ), + ); + } - String username = ''; - final TextEditingController _usernameController = TextEditingController(); - - List bankList = [ - "农业银行", - "建设银行", - "工商银行", - "中信银行", - "广发银行" - ]; @override Widget build(BuildContext context) { - return Scaffold( - appBar: PageAppbar(title: "提现"), - body: SingleChildScrollView( - child: Container( - padding: EdgeInsetsGeometry.symmetric( - horizontal: 28.w, - vertical: 16.w - ), - child: Column( - children: [ - Container( - padding: EdgeInsets.only( - bottom: 12.w - ), - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 1, - color: const Color.fromRGBO(238, 238, 238, 1) - ) - ) - ), - child: Row( - children: [ - Text( - "添加银行卡", - style: TextStyle( - fontSize: 14.w, - fontWeight: FontWeight.w500 - ), - ) - ], - ), + return GetX( + init: AddBankcardController(), + builder: (controller){ + return Scaffold( + appBar: PageAppbar(title: "提现"), + body: SingleChildScrollView( + child: Container( + padding: EdgeInsetsGeometry.symmetric( + horizontal: 28.w, + vertical: 16.w ), - addItem(label: "持卡人", child: TextField( - controller: _usernameController, - keyboardType: TextInputType.number, - style: TextStyle( - fontSize: ScreenUtil().setWidth(13), - height: 1, - ), - decoration: InputDecoration( - contentPadding: EdgeInsets.symmetric( - vertical: 0, - horizontal: 0 - ), - hintText: "请输入持卡人姓名", - hintStyle: TextStyle( - color: Colors.grey + child: Column( + children: [ + Container( + padding: EdgeInsets.only( + bottom: 12.w + ), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + width: 1, + color: const Color.fromRGBO(238, 238, 238, 1) + ) + ) + ), + child: Row( + children: [ + Text( + "添加银行卡", + style: TextStyle( + fontSize: 14.w, + fontWeight: FontWeight.w500 + ), + ) + ], + ), ), + addItem(label: "持卡人", child: TextField( + controller: controller.usernameController.value, + keyboardType: TextInputType.number, + style: TextStyle( + fontSize: ScreenUtil().setWidth(13), + height: 1, + ), + decoration: InputDecoration( + contentPadding: EdgeInsets.symmetric( + vertical: 0, + horizontal: 0 + ), + hintText: "请输入持卡人姓名", + hintStyle: TextStyle( + color: Colors.grey + ), - border: const OutlineInputBorder( - borderSide: BorderSide.none, // 这将移除边框 // 可选:设置圆角 - ), - // 如果你希望聚焦时和未聚焦时都没有边框,也可以设置 focusedBorder 和 enabledBorder - focusedBorder: const OutlineInputBorder( - borderSide: BorderSide.none, - borderRadius: BorderRadius.all(Radius.circular(4.0)), - ), - enabledBorder: const OutlineInputBorder( - borderSide: BorderSide.none, - borderRadius: BorderRadius.all(Radius.circular(4.0)), - ), - ), - onChanged: (value){ - username = value; - }, - )), - addItem(label: "卡号", child: TextField( - controller: _usernameController, - keyboardType: TextInputType.number, - style: TextStyle( - fontSize: ScreenUtil().setWidth(13), - height: 1 - ), - decoration: InputDecoration( - contentPadding: EdgeInsets.symmetric( - vertical: 0, - horizontal: 0 - ), - hintText: "请输入银行卡号", - hintStyle: TextStyle( - color: Colors.grey - ), + border: const OutlineInputBorder( + borderSide: BorderSide.none, // 这将移除边框 // 可选:设置圆角 + ), + // 如果你希望聚焦时和未聚焦时都没有边框,也可以设置 focusedBorder 和 enabledBorder + focusedBorder: const OutlineInputBorder( + borderSide: BorderSide.none, + borderRadius: BorderRadius.all(Radius.circular(4.0)), + ), + enabledBorder: const OutlineInputBorder( + borderSide: BorderSide.none, + borderRadius: BorderRadius.all(Radius.circular(4.0)), + ), + ), + onChanged: (value){ + controller.username.value = value; + }, + )), + addItem(label: "卡号", child: TextField( + controller: controller.cardNumController.value, + keyboardType: TextInputType.number, + style: TextStyle( + fontSize: ScreenUtil().setWidth(13), + height: 1 + ), + decoration: InputDecoration( + contentPadding: EdgeInsets.symmetric( + vertical: 0, + horizontal: 0 + ), + hintText: "请输入银行卡号", + hintStyle: TextStyle( + color: Colors.grey + ), - border: const OutlineInputBorder( - borderSide: BorderSide.none, // 这将移除边框 // 可选:设置圆角 - ), - // 如果你希望聚焦时和未聚焦时都没有边框,也可以设置 focusedBorder 和 enabledBorder - focusedBorder: const OutlineInputBorder( - borderSide: BorderSide.none, - borderRadius: BorderRadius.all(Radius.circular(4.0)), - ), - enabledBorder: const OutlineInputBorder( - borderSide: BorderSide.none, - borderRadius: BorderRadius.all(Radius.circular(4.0)), - ), - ), - onChanged: (value){ - username = value; - }, - ), iconName: Icons.camera_alt_outlined), - addItem(label: "所属银行", child: Text( - "请选择所属银行", - style: TextStyle( - fontSize: 13.w, - color: Colors.grey - ), - ), iconName: Icons.keyboard_arrow_right).onTap((){ + border: const OutlineInputBorder( + borderSide: BorderSide.none, // 这将移除边框 // 可选:设置圆角 + ), + // 如果你希望聚焦时和未聚焦时都没有边框,也可以设置 focusedBorder 和 enabledBorder + focusedBorder: const OutlineInputBorder( + borderSide: BorderSide.none, + borderRadius: BorderRadius.all(Radius.circular(4.0)), + ), + enabledBorder: const OutlineInputBorder( + borderSide: BorderSide.none, + borderRadius: BorderRadius.all(Radius.circular(4.0)), + ), + ), + onChanged: (value){ + controller.cardNum.value = value; + }, + ), icon: Icon( + Icons.camera_alt_outlined, + size: 20.w, + color: const Color.fromRGBO(153, 153, 153, 1), + ).onTap((){ + _showAvatarOptions(controller); + })), + addItem(label: "所属银行", child: TextField( + controller: controller.bankNameController.value, + keyboardType: TextInputType.number, + style: TextStyle( + fontSize: ScreenUtil().setWidth(13), + height: 1, + ), + decoration: InputDecoration( + contentPadding: EdgeInsets.symmetric( + vertical: 0, + horizontal: 0 + ), + hintText: "请输入所属银行", + hintStyle: TextStyle( + color: Colors.grey + ), - showModalBottomSheet( - context: Get.context!, - builder: (BuildContext context) { - return Container( - height: 357.w, - color: Colors.white, - child: Column( - children: [ - Container( - height: 37.w, - color: const Color.fromRGBO(247, 247, 247, 1), - padding: EdgeInsetsGeometry.symmetric( - horizontal: 16.w - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - "取消", - style: TextStyle( - fontSize: 14.w, - color: const Color.fromRGBO(153, 153, 153, 1) - ), - ).onTap((){ - Navigator.pop(context); - }), - Text( - "选择所属银行", - style: TextStyle( - fontSize: 14.w, - fontWeight: FontWeight.w500 - ), - ), - Text( - "确定", - style: TextStyle( - fontSize: 14.w, - color: const Color.fromRGBO(238, 129, 27, 1) - ), - ), - ], - ), - ), - Expanded( - child: CupertinoPicker( - itemExtent: 60.w, - onSelectedItemChanged: (int value) { - print(value); - }, - children: [ - ...bankList.map((e){ - return Center( - child: Text( - e, - style: TextStyle( - fontSize: 14.w, - fontWeight: FontWeight.w500 - ), - ), - ); - }), - ], - ), - ) - ], - ), - ); - } - ); - }), - addItem(label: "开户行", child: Text( - "请选择开户支行", - style: TextStyle( - fontSize: 13.w, - color: Colors.grey - ), - ), iconName: Icons.keyboard_arrow_right), - SizedBox(height: 40.w,), - 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( - "确认添加", + border: const OutlineInputBorder( + borderSide: BorderSide.none, // 这将移除边框 // 可选:设置圆角 + ), + // 如果你希望聚焦时和未聚焦时都没有边框,也可以设置 focusedBorder 和 enabledBorder + focusedBorder: const OutlineInputBorder( + borderSide: BorderSide.none, + borderRadius: BorderRadius.all(Radius.circular(4.0)), + ), + enabledBorder: const OutlineInputBorder( + borderSide: BorderSide.none, + borderRadius: BorderRadius.all(Radius.circular(4.0)), + ), + ), + onChanged: (value){ + controller.bankName.value = value; + }, + )), + addItem(label: "开户行", child: TextField( + controller: controller.openingBankController.value, + keyboardType: TextInputType.number, style: TextStyle( - fontSize: 14.w, - color: Colors.white, - fontWeight: FontWeight.w500 + fontSize: ScreenUtil().setWidth(13), + height: 1, ), - ), - ), - ) - ], + decoration: InputDecoration( + contentPadding: EdgeInsets.symmetric( + vertical: 0, + horizontal: 0 + ), + hintText: "请输入开户行", + hintStyle: TextStyle( + color: Colors.grey + ), + + border: const OutlineInputBorder( + borderSide: BorderSide.none, // 这将移除边框 // 可选:设置圆角 + ), + // 如果你希望聚焦时和未聚焦时都没有边框,也可以设置 focusedBorder 和 enabledBorder + focusedBorder: const OutlineInputBorder( + borderSide: BorderSide.none, + borderRadius: BorderRadius.all(Radius.circular(4.0)), + ), + enabledBorder: const OutlineInputBorder( + borderSide: BorderSide.none, + borderRadius: BorderRadius.all(Radius.circular(4.0)), + ), + ), + onChanged: (value){ + controller.openingBank.value = value; + }, + )), + SizedBox(height: 40.w,), + 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, + color: Colors.white, + fontWeight: FontWeight.w500 + ), + ), + ), + ).onTap((){ + controller.saveCard(); + }) + ], + ), + ), ), - ), - ), + ); + }, ); } - Widget addItem({required String label, required Widget child, IconData? iconName}){ + Widget addItem({required String label, required Widget child, Widget? icon}){ return Container( height: 44.w, decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 1, - color: const Color.fromRGBO(238, 238, 238, 1) + border: Border( + bottom: BorderSide( + width: 1, + color: const Color.fromRGBO(238, 238, 238, 1) + ) ) - ) ), child: Row( children: [ @@ -267,13 +281,11 @@ class _AddBankcardPageState extends State { Expanded( child: child ), - if(iconName != null) Icon( - iconName, - size: 20.w, - color: const Color.fromRGBO(153, 153, 153, 1), - ) + icon ?? SizedBox(), ], ), ); } } + + diff --git a/lib/pages/mine/edit_info_page.dart b/lib/pages/mine/edit_info_page.dart index 4dbeaff..c2757c3 100644 --- a/lib/pages/mine/edit_info_page.dart +++ b/lib/pages/mine/edit_info_page.dart @@ -205,15 +205,37 @@ class _EditInfoPageState extends State { spacing: 5.w, runSpacing: 5.w, children: [ - ...controller.imgList.map((e){ - return ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(9.w)), - child: Image.network( - e, - width: 70.w, - height: 70.w, - fit: BoxFit.cover, - ), + ...controller.imgList.asMap().entries.map((entry){ + return Stack( + children: [ + ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(9.w)), + child: Image.network( + entry.value, + width: 70.w, + height: 70.w, + fit: BoxFit.cover, + ), + ), + Positioned( + right: 5.w, + top: 5.w, + child: Container( + width: 20.w, + height: 20.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(20.w)), + color: const Color.fromRGBO(0, 0, 0, .3) + ), + child: Icon( + Icons.close, + size: 20.w, + ), + ).onTap((){ + controller.imgList.removeAt(entry.key); + }), + ) + ], ); }), @@ -355,7 +377,7 @@ class _EditInfoPageState extends State { ), SetItem(label: "身高", child: Expanded( child: TextField( - controller: controller.heightController, + controller: controller.heightController.value, keyboardType: TextInputType.number, textAlign: TextAlign.end, style: TextStyle( @@ -388,7 +410,7 @@ class _EditInfoPageState extends State { ), ), onChanged: (value){ - controller.height = value; + controller.height.value = value; setState(() { }); @@ -454,16 +476,8 @@ class _EditInfoPageState extends State { (e) => e["label"] == selected[1], orElse: () => {}, ); - if(city.isNotEmpty){ - Map district = city["children"].firstWhere( - (e) => e["label"] == selected[2], - orElse: () => {}, - ); - if(city.isNotEmpty){ - controller.homeLocationValue.value = [province["value"], city["value"], district["value"]]; - print([province["value"], city["value"], district["value"]]); - } - } + controller.homeLocationValue.value = [province["value"], city["value"]]; + print([province["value"], city["value"]]); } setState(() { @@ -471,7 +485,7 @@ class _EditInfoPageState extends State { Navigator.of(context).pop(); }, data: controller.areaShowData, - columnNum: 3, + columnNum: 2, initialData:[]); }, child: Text( @@ -750,7 +764,7 @@ class _EditInfoPageState extends State { Row( children: [ Text( - "晨晨子", + controller.userData.value?.nickName ?? "", style: TextStyle( fontSize: 19.w, color: const Color.fromRGBO(51, 51, 51, 1), @@ -758,7 +772,7 @@ class _EditInfoPageState extends State { ), ), SizedBox(width: 13.w,), - Container( + if(controller.userData.value?.genderCode == 1) Container( width: 33.w, height: 13.w, decoration: BoxDecoration( @@ -775,7 +789,7 @@ class _EditInfoPageState extends State { ), SizedBox(width: 1.w,), Text( - "19", + controller.calculateAge(controller.userData.value?.birthDate ?? "1970-1-1").toString(), style: TextStyle( fontSize: 9.w, color: const Color.fromRGBO(255, 66, 236, 1) @@ -804,7 +818,7 @@ class _EditInfoPageState extends State { ), ), SizedBox(width: 4.w,), - Container( + if(controller.userData.value?.identityCard != null) Container( width: 43.w, height: 13.w, decoration: BoxDecoration( @@ -831,7 +845,7 @@ class _EditInfoPageState extends State { ), ), SizedBox(width: 4.w,), - Container( + if(controller.userData.value?.genderCode == 0) Container( width: 33.w, height: 13.w, decoration: BoxDecoration( @@ -848,7 +862,7 @@ class _EditInfoPageState extends State { ), SizedBox(width: 1.w,), Text( - "19", + controller.calculateAge(controller.userData.value?.birthDate ?? "").toString(), style: TextStyle( fontSize: 9.w, color: const Color.fromRGBO(120, 140, 255, 1) @@ -913,14 +927,14 @@ class _EditInfoPageState extends State { ), SizedBox(height: 16.w,), Text( - "IP属地:广东", + "IP属地:${controller.location.value == '' ? controller.userData.value?.provinceName : controller.location.value.split("-")[0]}", style: TextStyle( fontSize: 9.w, color: const Color.fromRGBO(144, 144, 144, 1) ), ), Text( - "动我ID:16099665", + "动我ID:${controller.userData.value?.id}", style: TextStyle( fontSize: 9.w, color: const Color.fromRGBO(144, 144, 144, 1) @@ -1008,6 +1022,7 @@ class _EditInfoPageState extends State { entry.value, width: 38.w, height: 38.w, + fit: BoxFit.cover, ), ), ), diff --git a/lib/pages/mine/withdraw_page.dart b/lib/pages/mine/withdraw_page.dart index 51a5de7..c679ec8 100644 --- a/lib/pages/mine/withdraw_page.dart +++ b/lib/pages/mine/withdraw_page.dart @@ -1,227 +1,245 @@ import 'package:dating_touchme_app/components/page_appbar.dart'; +import 'package:dating_touchme_app/controller/mine/withdraw_controller.dart'; import 'package:dating_touchme_app/extension/ex_widget.dart'; import 'package:dating_touchme_app/generated/assets.dart'; +import 'package:dating_touchme_app/model/mine/bank_card_data.dart'; import 'package:dating_touchme_app/pages/mine/add_bankcard_page.dart'; import 'package:dating_touchme_app/pages/mine/withdraw_history_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -class WithdrawPage extends StatefulWidget { +class WithdrawPage extends StatelessWidget { const WithdrawPage({super.key}); - @override - State createState() => _WithdrawPageState(); -} + String maskKeepLast(String s, int keep) { + if (s.length <= keep) return s; + return '*' * (s.length - keep) + s.substring(s.length - keep); + } -class _WithdrawPageState extends State { @override Widget build(BuildContext context) { - return Scaffold( - appBar: PageAppbar(title: "提现"), - body: SingleChildScrollView( - child: Column( - children: [ - Container( - padding: EdgeInsetsGeometry.symmetric( - horizontal: 16.w, - vertical: 19.w - ), - margin: EdgeInsets.only( - bottom: 17.w - ), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "到账银行卡", - style: TextStyle( - fontSize: 12.w, - ), + return GetX( + init: WithdrawController(), + builder: (controller){ + return Scaffold( + appBar: PageAppbar(title: "提现"), + body: SingleChildScrollView( + child: Column( + children: [ + Container( + padding: EdgeInsetsGeometry.symmetric( + horizontal: 16.w, + vertical: 19.w ), - SizedBox(width: 24.w,), - Expanded( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, + margin: EdgeInsets.only( + bottom: 17.w + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "到账银行卡", + style: TextStyle( + fontSize: 12.w, + ), + ), + SizedBox(width: 24.w,), + Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - "工商银行(7846)", - style: TextStyle( - fontSize: 13.w, - fontWeight: FontWeight.w500 - ), + if(controller.nowBankCard.value.id != null) Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "${controller.nowBankCard.value.bankName}(${controller.nowBankCard.value.cardNum!.substring(controller.nowBankCard.value.cardNum!.length - 4)})", + style: TextStyle( + fontSize: 13.w, + fontWeight: FontWeight.w500 + ), + ), + SizedBox(height: 6.w,), + Text( + "1个工作日内到账", + style: TextStyle( + fontSize: 12.w, + color: const Color.fromRGBO(153, 153, 153, 1) + ), + ) + ], ), - SizedBox(height: 6.w,), - Text( - "1个工作日内到账", + if(controller.nowBankCard.value.id == null) Text( + "点击选择银行卡", style: TextStyle( - fontSize: 12.w, - color: const Color.fromRGBO(153, 153, 153, 1) + fontSize: 12.w, + color: const Color.fromRGBO(153, 153, 153, 1) ), + ), + Icon( + Icons.keyboard_arrow_right, + size: 15.w, + color: const Color.fromRGBO(153, 153, 153, 1), ) ], ), - Icon( - Icons.keyboard_arrow_right, - size: 15.w, - color: const Color.fromRGBO(153, 153, 153, 1), - ) - ], - ), - ) - ], - ).onTap(() { - showModalBottomSheet( - context: Get.context!, - builder: (BuildContext context) { - return Container( - height: 357.w, - color: Colors.white, - child: Column( - children: [ - Container( - height: 37.w, - color: const Color.fromRGBO(247, 247, 247, 1), - padding: EdgeInsetsGeometry.symmetric( - horizontal: 16.w - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + ) + ], + ).onTap(() { + showModalBottomSheet( + context: Get.context!, + builder: (BuildContext context) { + return Obx(() { + return Container( + height: 357.w, + color: Colors.white, + child: Column( children: [ - Text( - "取消", - style: TextStyle( - fontSize: 14.w, - color: const Color.fromRGBO(153, 153, 153, 1) + Container( + height: 37.w, + color: const Color.fromRGBO(247, 247, 247, 1), + padding: EdgeInsetsGeometry.symmetric( + horizontal: 16.w ), - ).onTap((){ - Navigator.pop(context); - }), - Text( - "选择到账银行卡", - style: TextStyle( - fontSize: 14.w, - fontWeight: FontWeight.w500 + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "取消", + style: TextStyle( + fontSize: 14.w, + color: const Color.fromRGBO(153, 153, 153, 1) + ), + ).onTap((){ + Navigator.pop(context); + }), + Text( + "选择到账银行卡", + style: TextStyle( + fontSize: 14.w, + fontWeight: FontWeight.w500 + ), + ), + Text( + "取消", + style: TextStyle( + fontSize: 14.w, + color: const Color.fromRGBO(153, 153, 153, 0) + ), + ), + ], ), ), - Text( - "取消", - style: TextStyle( - fontSize: 14.w, - color: const Color.fromRGBO(153, 153, 153, 0) + Expanded( + child: SingleChildScrollView( + child: Container( + padding: EdgeInsets.all(16.w), + child: Column( + children: [ + ...controller.bankCardList.map((e){ + return cardItem(e, controller).onTap((){ + controller.nowBankCard.value = e; + Get.back(); + }); + }), + addCard().onTap((){ + Get.to(() => AddBankcardPage())?.then((e){ + controller.getBankCard(); + }); + }), + ], + ), + ), ), - ), + ) ], ), - ), - Expanded( - child: SingleChildScrollView( - child: Container( - padding: EdgeInsets.all(16.w), - child: Column( - children: [ - cardItem(), - cardItem(), - cardItem(), - cardItem(), - cardItem(), - cardItem(), - addCard().onTap((){ - Get.to(() => AddBankcardPage()); - }), - ], - ), - ), - ), - ) - ], - ), - ); - } - ); - }), - ), - Container( - padding: EdgeInsetsGeometry.symmetric( - horizontal: 16.w - ), - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Text( - "提现金额", - style: TextStyle( - fontSize: 12.w, - color: Colors.black - ), - ) - ], + ); + }); + } + ); + }), + ), + Container( + padding: EdgeInsetsGeometry.symmetric( + horizontal: 16.w ), - SizedBox(height: 12.w,), - Row( - crossAxisAlignment: CrossAxisAlignment.start, + child: Column( children: [ - Text( - "¥", - style: TextStyle( - fontSize: 24.w, - color: Colors.black, - fontWeight: FontWeight.w500 - ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + "提现金额", + style: TextStyle( + fontSize: 12.w, + color: Colors.black + ), + ) + ], + ), + SizedBox(height: 12.w,), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "¥", + style: TextStyle( + fontSize: 24.w, + color: Colors.black, + fontWeight: FontWeight.w500 + ), + ) + ], + ), + SizedBox(height: 16.w,), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "可提现金额:${controller.money}元", + style: TextStyle( + fontSize: 12.w, + color: const Color.fromRGBO(153, 153, 153, 1) + ), + ), + Text( + "提现记录", + style: TextStyle( + fontSize: 12.w, + color: const Color.fromRGBO(25, 114, 248, 1) + ), + ).onTap((){ + Get.to(() => WithdrawHistoryPage()); + }) + ], ) ], ), - SizedBox(height: 16.w,), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - "可提现金额:3880.00元", - style: TextStyle( - fontSize: 12.w, - color: const Color.fromRGBO(153, 153, 153, 1) - ), - ), - Text( - "提现记录", - style: TextStyle( - fontSize: 12.w, - color: const Color.fromRGBO(25, 114, 248, 1) - ), - ).onTap((){ - Get.to(() => WithdrawHistoryPage()); - }) - ], - ) - ], - ), - ) - ], - ), - ), + ) + ], + ), + ), + ); + }, ); } - Widget cardItem(){ + Widget cardItem(BankCardData item, WithdrawController controller){ return Container( padding: EdgeInsets.only( - bottom: 12.w + bottom: 12.w ), margin: EdgeInsets.only( - bottom: 20.w + bottom: 20.w ), decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 1, - color: const Color.fromRGBO(238, 238, 238, 1) + border: Border( + bottom: BorderSide( + width: 1, + color: const Color.fromRGBO(238, 238, 238, 1) + ) ) - ) ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -237,14 +255,14 @@ class _WithdrawPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "工商银行", + "${item.bankName}", style: TextStyle( - fontSize: 14.w, - fontWeight: FontWeight.w500 + fontSize: 14.w, + fontWeight: FontWeight.w500 ), ), Text( - "**** **** **** 236", + "${maskKeepLast(item.cardNum ?? "", 4)}", style: TextStyle( fontSize: 14.w, color: const Color.fromRGBO(153, 153, 153, 1) @@ -254,8 +272,8 @@ class _WithdrawPageState extends State { ) ], ), - Icon( - Icons.check, + if(item.id == controller.nowBankCard.value.id) Icon( + Icons.check, size: 20.w, color: const Color.fromRGBO(238, 129, 27, 1), ) @@ -308,5 +326,5 @@ class _WithdrawPageState extends State { ), ); } - } +