diff --git a/assets/images/mic_coupon_icon.png b/assets/images/mic_coupon_icon.png new file mode 100644 index 0000000..488819f Binary files /dev/null and b/assets/images/mic_coupon_icon.png differ diff --git a/lib/controller/mine/mine_controller.dart b/lib/controller/mine/mine_controller.dart index f29b4fe..95d2982 100644 --- a/lib/controller/mine/mine_controller.dart +++ b/lib/controller/mine/mine_controller.dart @@ -16,11 +16,6 @@ import '../../pages/setting/setting_page.dart'; class MineController extends GetxController { - final infoList = [ - {"label": "好友", "num": 0, "type": 1}, - {"label": "好友申请", "num": 0, "type": 2}, - {"label": "访客", "num": 0, "type": 3}, - ].obs; final blockList = [ {"icon": Assets.imagesRose, "title": "我的玫瑰", "subTitle": "新人限时福利", "path": () => RosePage()}, @@ -49,28 +44,6 @@ class MineController extends GetxController { userData.value = GlobalData().userData; userId.value = GlobalData().userId; _userApi = Get.find(); - getUserCount(); - } - - getUserCount() async { - try { - final response = await _userApi.userGetDongwoOwnUserCount(); - if (response.data.isSuccess && response.data.data != null) { - countData.value = response.data.data ?? UserCountData(friendNum: 0, friendApplyNum: 0, visitorNum:0); - infoList[0]["num"] = countData.value.friendNum; - infoList[1]["num"] = countData.value.friendApplyNum; - infoList[2]["num"] = countData.value.visitorNum; - } 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/my_friend_controller.dart b/lib/controller/mine/my_friend_controller.dart index 3de52ca..6075d1d 100644 --- a/lib/controller/mine/my_friend_controller.dart +++ b/lib/controller/mine/my_friend_controller.dart @@ -106,8 +106,12 @@ class MyFriendController extends GetxController with GetSingleTickerProviderStat "status": status }); if (response.data.isSuccess) { - SmartDialog.showToast(response.data.message); item.status = status; + if(status == 2){ + SmartDialog.showToast('添加成功'); + } else if(status == 3){ + SmartDialog.showToast('拒绝成功'); + } } else { // 响应失败,抛出异常 diff --git a/lib/controller/mine/rose_history_controller.dart b/lib/controller/mine/rose_history_controller.dart index a9074f3..044bf56 100644 --- a/lib/controller/mine/rose_history_controller.dart +++ b/lib/controller/mine/rose_history_controller.dart @@ -3,6 +3,7 @@ import 'package:dating_touchme_app/network/user_api.dart'; import 'package:easy_refresh/easy_refresh.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:get/get.dart'; +import 'package:dating_touchme_app/model/mine/user_prop_data.dart' as up; class RoseHistoryController extends GetxController { @@ -14,6 +15,8 @@ class RoseHistoryController extends GetxController { final roseHistoryList = [].obs; + final propList = [].obs; + final page = 1.obs; final size = 10.obs; @@ -34,9 +37,42 @@ class RoseHistoryController extends GetxController { changeNavTab(int i) async { roseHistoryList.clear(); + propList.clear(); friendNavActive.value = i; page.value = 1; - getHistoryList(); + if(i != 2){ + getHistoryList(); + } else { + getPropList(); + } + } + + getPropList() async { + try{ + final response = await _userApi.userPageUserProp( + pageNum: page.value, + pageSize: size.value, + ); + if (response.data.isSuccess && response.data.data != null) { + final data = response.data.data?.records ?? []; + + propList.addAll(data.toList()); + if((data.length ?? 0) == size.value){ + + listRefreshController.finishLoad(IndicatorResult.success); + } else { + listRefreshController.finishLoad(IndicatorResult.noMore); + } + } else { + + // 响应失败,抛出异常 + throw Exception(response.data.message ?? '获取数据失败'); + } + } catch(e) { + print('玫瑰记录获取失败: $e'); + SmartDialog.showToast('玫瑰记录获取失败'); + rethrow; + } } getHistoryList() async { diff --git a/lib/generated/assets.dart b/lib/generated/assets.dart index b9f8919..05faea3 100644 --- a/lib/generated/assets.dart +++ b/lib/generated/assets.dart @@ -70,6 +70,7 @@ class Assets { static const String imagesAd = 'assets/images/ad.png'; static const String imagesAdd = 'assets/images/add.png'; static const String imagesAliPay = 'assets/images/ali_pay.png'; + static const String imagesAppLogo = 'assets/images/app_logo.jpg'; static const String imagesArrow = 'assets/images/arrow.png'; static const String imagesArrowForwardRight = 'assets/images/arrow_forward_right.png'; static const String imagesArrowR = 'assets/images/arrow_r.png'; @@ -137,6 +138,7 @@ class Assets { static const String imagesMessageNol = 'assets/images/message_nol.png'; static const String imagesMessagePre = 'assets/images/message_pre.png'; static const String imagesMicClose = 'assets/images/mic_close.png'; + static const String imagesMicCouponIcon = 'assets/images/mic_coupon_icon.png'; static const String imagesMicLine = 'assets/images/mic_line.png'; static const String imagesMicOff = 'assets/images/mic_off.png'; static const String imagesMicOpen = 'assets/images/mic_open.png'; diff --git a/lib/model/mine/friend_apply_data.dart b/lib/model/mine/friend_apply_data.dart index 7352b6e..535dfb9 100644 --- a/lib/model/mine/friend_apply_data.dart +++ b/lib/model/mine/friend_apply_data.dart @@ -44,6 +44,13 @@ class Records { int? toGenderCode; Null? applyMsg; int? status; + String? birthYear; + String? birthDate; + int? age; + int? provinceCode; + String? provinceName; + int? cityCode; + String? cityName; Records( {this.id, @@ -54,7 +61,14 @@ class Records { this.toProfilePhoto, this.toGenderCode, this.applyMsg, - this.status}); + this.status, + this.birthYear, + this.birthDate, + this.age, + this.provinceCode, + this.provinceName, + this.cityCode, + this.cityName}); Records.fromJson(Map json) { id = json['id']; @@ -66,6 +80,13 @@ class Records { toGenderCode = json['toGenderCode']; applyMsg = json['applyMsg']; status = json['status']; + birthYear = json['birthYear']; + birthDate = json['birthDate']; + age = json['age']; + provinceCode = json['provinceCode']; + provinceName = json['provinceName']; + cityCode = json['cityCode']; + cityName = json['cityName']; } Map toJson() { @@ -79,6 +100,13 @@ class Records { data['toGenderCode'] = this.toGenderCode; data['applyMsg'] = this.applyMsg; data['status'] = this.status; + data['birthYear'] = this.birthYear; + data['birthDate'] = this.birthDate; + data['age'] = this.age; + data['provinceCode'] = this.provinceCode; + data['provinceName'] = this.provinceName; + data['cityCode'] = this.cityCode; + data['cityName'] = this.cityName; return data; } } diff --git a/lib/model/mine/friend_data.dart b/lib/model/mine/friend_data.dart index b60f392..247b254 100644 --- a/lib/model/mine/friend_data.dart +++ b/lib/model/mine/friend_data.dart @@ -34,42 +34,70 @@ class FriendData { } class Records { - int? genderCode; String? id; + String? userId; String? miId; String? nickName; String? profilePhoto; - String? uid; - String? userId; + int? genderCode; + String? birthYear; + String? birthDate; + int? age; + int? provinceCode; + String? provinceName; + int? cityCode; + String? cityName; + int? uid; Records( - {this.genderCode, - this.id, + {this.id, + this.userId, this.miId, this.nickName, this.profilePhoto, - this.uid, - this.userId}); + this.genderCode, + this.birthYear, + this.birthDate, + this.age, + this.provinceCode, + this.provinceName, + this.cityCode, + this.cityName, + this.uid}); Records.fromJson(Map json) { - genderCode = json['genderCode']; id = json['id']; + userId = json['userId']; miId = json['miId']; nickName = json['nickName']; profilePhoto = json['profilePhoto']; + genderCode = json['genderCode']; + birthYear = json['birthYear']; + birthDate = json['birthDate']; + age = json['age']; + provinceCode = json['provinceCode']; + provinceName = json['provinceName']; + cityCode = json['cityCode']; + cityName = json['cityName']; uid = json['uid']; - userId = json['userId']; } Map toJson() { final Map data = new Map(); - data['genderCode'] = this.genderCode; data['id'] = this.id; + data['userId'] = this.userId; data['miId'] = this.miId; data['nickName'] = this.nickName; data['profilePhoto'] = this.profilePhoto; + data['genderCode'] = this.genderCode; + data['birthYear'] = this.birthYear; + data['birthDate'] = this.birthDate; + data['age'] = this.age; + data['provinceCode'] = this.provinceCode; + data['provinceName'] = this.provinceName; + data['cityCode'] = this.cityCode; + data['cityName'] = this.cityName; data['uid'] = this.uid; - data['userId'] = this.userId; return data; } } diff --git a/lib/model/mine/user_prop_data.dart b/lib/model/mine/user_prop_data.dart new file mode 100644 index 0000000..9557960 --- /dev/null +++ b/lib/model/mine/user_prop_data.dart @@ -0,0 +1,83 @@ +class UserPropData { + int? current; + int? pages; + List? records; + int? size; + int? total; + + UserPropData({this.current, this.pages, this.records, this.size, this.total}); + + UserPropData.fromJson(Map json) { + current = json['current']; + pages = json['pages']; + if (json['records'] != null) { + records = []; + json['records'].forEach((v) { + records!.add(new Records.fromJson(v)); + }); + } + size = json['size']; + total = json['total']; + } + + Map toJson() { + final Map data = new Map(); + data['current'] = this.current; + data['pages'] = this.pages; + if (this.records != null) { + data['records'] = this.records!.map((v) => v.toJson()).toList(); + } + data['size'] = this.size; + data['total'] = this.total; + return data; + } +} + +class Records { + bool? enable; + String? endTime; + int? id; + String? logoUrl; + String? name; + int? num; + String? startTime; + int? type; + int? userId; + + Records( + {this.enable, + this.endTime, + this.id, + this.logoUrl, + this.name, + this.num, + this.startTime, + this.type, + this.userId}); + + Records.fromJson(Map json) { + enable = json['enable']; + endTime = json['endTime']; + id = json['id']; + logoUrl = json['logoUrl']; + name = json['name']; + num = json['num']; + startTime = json['startTime']; + type = json['type']; + userId = json['userId']; + } + + Map toJson() { + final Map data = new Map(); + data['enable'] = this.enable; + data['endTime'] = this.endTime; + data['id'] = this.id; + data['logoUrl'] = this.logoUrl; + data['name'] = this.name; + data['num'] = this.num; + data['startTime'] = this.startTime; + data['type'] = this.type; + data['userId'] = this.userId; + return data; + } +} diff --git a/lib/network/api_urls.dart b/lib/network/api_urls.dart index 9e55a17..06241e9 100644 --- a/lib/network/api_urls.dart +++ b/lib/network/api_urls.dart @@ -96,6 +96,8 @@ class ApiUrls { 'dating-agency-chat-audio/user/page/friend-apply'; static const String userConfirmFriendApply = 'dating-agency-chat-audio/user/confirm/friend-apply'; + static const String userPageUserProp = + 'dating-agency-chat-audio/user/page/user-prop'; //首页相关接口 static const String getMarriageList = diff --git a/lib/network/user_api.dart b/lib/network/user_api.dart index 91410d2..e641780 100644 --- a/lib/network/user_api.dart +++ b/lib/network/user_api.dart @@ -13,6 +13,7 @@ import 'package:dating_touchme_app/model/mine/rose_history_data.dart'; import 'package:dating_touchme_app/model/mine/user_base_data.dart'; import 'package:dating_touchme_app/model/mine/user_count_data.dart'; import 'package:dating_touchme_app/model/mine/user_data.dart'; +import 'package:dating_touchme_app/model/mine/user_prop_data.dart'; import 'package:dating_touchme_app/model/mine/user_rose_data.dart'; import 'package:dating_touchme_app/model/mine/wallet_account_data.dart'; import 'package:dating_touchme_app/model/mine/wallet_account_record_data.dart'; @@ -249,4 +250,10 @@ abstract class UserApi { Future>> userConfirmFriendApply( @Body() Map data, ); + + @GET(ApiUrls.userPageUserProp) + Future>> userPageUserProp({ + @Query('pageNum') required int pageNum, + @Query('pageSize') required int pageSize, + }); } diff --git a/lib/network/user_api.g.dart b/lib/network/user_api.g.dart index b5f7c71..05d71b0 100644 --- a/lib/network/user_api.g.dart +++ b/lib/network/user_api.g.dart @@ -1523,6 +1523,43 @@ class _UserApi implements UserApi { return httpResponse; } + @override + Future>> userPageUserProp({ + required int pageNum, + required int pageSize, + }) async { + final _extra = {}; + final queryParameters = { + r'pageNum': pageNum, + r'pageSize': pageSize, + }; + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + 'dating-agency-chat-audio/user/page/user-prop', + 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) => UserPropData.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/mine/mine_page.dart b/lib/pages/mine/mine_page.dart index 2329efb..0b49ea3 100644 --- a/lib/pages/mine/mine_page.dart +++ b/lib/pages/mine/mine_page.dart @@ -2,6 +2,8 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:dating_touchme_app/controller/global.dart'; import 'package:dating_touchme_app/controller/mine/mine_controller.dart'; import 'package:dating_touchme_app/extension/ex_widget.dart'; +import 'package:dating_touchme_app/model/mine/user_count_data.dart'; +import 'package:dating_touchme_app/network/user_api.dart'; import 'package:dating_touchme_app/pages/mine/edit_info_page.dart'; import 'package:dating_touchme_app/pages/mine/my_friend_page.dart'; import 'package:dating_touchme_app/pages/mine/vip_page.dart'; @@ -23,6 +25,17 @@ class MinePage extends StatefulWidget { class _MinePageState extends State with AutomaticKeepAliveClientMixin{ + late MineController controller; + + final countData = UserCountData(friendNum: 0, friendApplyNum: 0, visitorNum:0).obs; + late UserApi _userApi; + + final infoList = [ + {"label": "好友", "num": 0, "type": 1}, + {"label": "好友申请", "num": 0, "type": 2}, + {"label": "访客", "num": 0, "type": 3}, + ].obs; + @override void initState() { @@ -30,19 +43,50 @@ class _MinePageState extends State with AutomaticKeepAliveClientMixin{ // 确保 HomeController 已注册 if (!Get.isRegistered()) { - Get.put(MineController()); + controller = Get.put(MineController()); + } else { + controller = Get.find(); } + _userApi = Get.find(); + getUserCount(); } + getUserCount() async { + try { + final response = await _userApi.userGetDongwoOwnUserCount(); + if (response.data.isSuccess && response.data.data != null) { + countData.value = response.data.data ?? UserCountData(friendNum: 0, friendApplyNum: 0, visitorNum:0); + infoList.value = [ + {"label": "好友", "num": countData.value.friendNum, "type": 1}, + {"label": "好友申请", "num": countData.value.friendApplyNum, "type": 2}, + {"label": "访客", "num": countData.value.visitorNum, "type": 3}, + ]; + setState(() { + + }); + } else { + + // 响应失败,抛出异常 + throw Exception(response.data.message ?? '获取数据失败'); + } + } catch(e){ + print('用户数据获取失败: $e'); + SmartDialog.showToast('用户数据获取失败'); + rethrow; + + } + } + @override Widget build(BuildContext context) { super.build(context); - return GetBuilder( + return GetX( init: MineController(), builder: (controller) { + controller.userData.value = GlobalData().userData; controller.userId.value = GlobalData().userId; return Container( @@ -76,24 +120,24 @@ class _MinePageState extends State with AutomaticKeepAliveClientMixin{ Row( children: [ ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(60.w)), - child: (controller.userData.value?.profilePhoto?.isNotEmpty ?? false) ? CachedNetworkImage( - imageUrl: "${controller.userData.value?.profilePhoto ?? ""}?x-oss-process=image/format,webp/resize,w_120", - width: 60.w, - height: 60.w, - imageBuilder: (context, imageProvider) => Container( - decoration: BoxDecoration( - image: DecorationImage( - image: imageProvider, - fit: BoxFit.cover, + borderRadius: BorderRadius.all(Radius.circular(60.w)), + child: (controller.userData.value?.profilePhoto?.isNotEmpty ?? false) ? CachedNetworkImage( + imageUrl: "${controller.userData.value?.profilePhoto ?? ""}?x-oss-process=image/format,webp/resize,w_120", + width: 60.w, + height: 60.w, + imageBuilder: (context, imageProvider) => Container( + decoration: BoxDecoration( + image: DecorationImage( + image: imageProvider, + fit: BoxFit.cover, + ), ), ), - ), - ) : Image.asset( - Assets.imagesUserAvatar, - width: 60.w, - height: 60.w, - ) + ) : Image.asset( + Assets.imagesUserAvatar, + width: 60.w, + height: 60.w, + ) ), SizedBox(width: 14.w,), Column( @@ -194,8 +238,8 @@ class _MinePageState extends State with AutomaticKeepAliveClientMixin{ child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - ...controller.infoList.map((e){ - return InfoItem(item: e); + ...infoList.map((e){ + return InfoItem(item: e, getUserCount: getUserCount,); }), ], ), @@ -257,7 +301,8 @@ class _MinePageState extends State with AutomaticKeepAliveClientMixin{ class InfoItem extends StatefulWidget { final Map item; - const InfoItem({super.key, required this.item}); + final Function getUserCount; + const InfoItem({super.key, required this.item, required this.getUserCount}); @override State createState() => _InfoItemState(); @@ -266,48 +311,63 @@ class InfoItem extends StatefulWidget { class _InfoItemState extends State { @override Widget build(BuildContext context) { - return Column( - children: [ - Stack( - clipBehavior: Clip.none, - children: [ - Text( - "${widget.item["num"]}", - style: TextStyle( - fontSize: 15.w, - color: Colors.black, - fontWeight: FontWeight.w700 - ), - ), - if(widget.item["type"] == 2 && widget.item["num"] != 0)Positioned( - right: -5.w, - top: 0, - child: Container( - width: 5.w, - height: 5.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(5.w)), - color: const Color.fromRGBO(255, 87, 51, 1) + return Expanded( + child: Container( + alignment: widget.item["type"] == 1 ? Alignment.centerLeft : widget.item["type"] == 2 ? Alignment.center : Alignment.centerRight, + child: Column( + children: [ + Stack( + clipBehavior: Clip.none, + children: [ + Text( + "${widget.item["num"]}", + style: TextStyle( + fontSize: 15.w, + color: Colors.black, + fontWeight: FontWeight.w700 + ), + ), + if(widget.item["type"] == 2 && widget.item["num"] != 0)Positioned( + right: -5.w, + top: 0, + child: Container( + width: 5.w, + height: 5.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(5.w)), + color: const Color.fromRGBO(255, 87, 51, 1) + ), + ), + ) + ], ), - ), + Text( + widget.item["label"], + style: TextStyle( + fontSize: 10.w, + color: const Color.fromRGBO(166, 166, 166, 1), + ), + ) + ], ) - ], - ), - Text( - widget.item["label"], - style: TextStyle( - fontSize: 10.w, - color: const Color.fromRGBO(166, 166, 166, 1), - ), - ) - ], - ).onTap((){ - if(widget.item['type'] == 3){ - Get.to(()=> VisitorListPage()); - } else { - Get.to(()=> MyFriendPage()); - } - }); + ).onTap((){ + if(widget.item['type'] == 3){ + Get.to(()=> VisitorListPage())?.then((w) async { + await widget.getUserCount(); + setState(() { + + }); + }); + } else { + Get.to(()=> MyFriendPage())?.then((w) async { + await widget.getUserCount(); + setState(() { + + }); + }); + } + }) + ); } } diff --git a/lib/pages/mine/my_friend_page.dart b/lib/pages/mine/my_friend_page.dart index cedd4eb..4c3c087 100644 --- a/lib/pages/mine/my_friend_page.dart +++ b/lib/pages/mine/my_friend_page.dart @@ -20,7 +20,7 @@ class MyFriendPage extends StatelessWidget { init: MyFriendController(), builder: (controller){ return Scaffold( - appBar: PageAppbar(title: "我的关注"), + appBar: PageAppbar(title: "我的好友"), body: EasyRefresh( controller: controller.listRefreshController, header: const ClassicHeader( @@ -252,7 +252,7 @@ class _UserItemState extends State { ], ), Text( - "30岁·广州", + "${widget.item.age}岁·${widget.item.cityName}", style: TextStyle( fontSize: 11.w, color: const Color.fromRGBO(144, 144, 144, 1), @@ -348,7 +348,7 @@ class _AddUserItemState extends State { ], ), Text( - "30岁·广州", + "${widget.item.age}岁·${widget.item.cityName}", style: TextStyle( fontSize: 11.w, color: const Color.fromRGBO(144, 144, 144, 1), @@ -427,6 +427,9 @@ class _AddUserItemState extends State { onPressed: () async { await widget.controller.applyFriend(widget.item.id ?? "", 2, widget.item); Navigator.of(context).pop(); + setState(() { + + }); }, ), // 通常是按钮 @@ -435,6 +438,9 @@ class _AddUserItemState extends State { onPressed: () async { await widget.controller.applyFriend(widget.item.id ?? "", 3, widget.item); Navigator.of(context).pop(); + setState(() { + + }); }, ), ], diff --git a/lib/pages/mine/rose_history_page.dart b/lib/pages/mine/rose_history_page.dart index b55b3cc..3c83dcd 100644 --- a/lib/pages/mine/rose_history_page.dart +++ b/lib/pages/mine/rose_history_page.dart @@ -6,6 +6,7 @@ import 'package:easy_refresh/easy_refresh.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; +import 'package:dating_touchme_app/model/mine/user_prop_data.dart' as up; class RoseHistoryPage extends StatelessWidget { @@ -46,7 +47,12 @@ class RoseHistoryPage extends StatelessWidget { print('推荐列表下拉刷新被触发'); controller.page.value = 1; controller.roseHistoryList.clear(); - await controller.getHistoryList(); + controller.propList.clear(); + if(controller.friendNavActive.value != 2){ + await controller.getHistoryList(); + } else { + await controller.getPropList(); + } controller.listRefreshController.finishRefresh(IndicatorResult.success); controller.listRefreshController.finishLoad(IndicatorResult.none); }, @@ -54,7 +60,11 @@ class RoseHistoryPage extends StatelessWidget { onLoad: () async { print('推荐列表上拉加载被触发, hasMore: '); controller.page.value += 1; - controller.getHistoryList(); + if(controller.friendNavActive.value != 2){ + controller.getHistoryList(); + } else { + controller.getPropList(); + } }, child: SingleChildScrollView( child: Container( @@ -106,26 +116,9 @@ class RoseHistoryPage extends StatelessWidget { }) ], 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(), + ...controller.propList.map((e) { + return ChatCouponItem(item: e,); + }) ], ], ), @@ -221,7 +214,8 @@ class _SendItemState extends State { } class ChatCouponItem extends StatefulWidget { - const ChatCouponItem({super.key}); + final up.Records item; + const ChatCouponItem({super.key, required this.item}); @override State createState() => _ChatCouponItemState(); @@ -238,7 +232,7 @@ class _ChatCouponItemState extends State { Row( children: [ Image.asset( - Assets.imagesChatCouponIcon, + widget.item.type == 1 ? Assets.imagesChatCouponIcon : Assets.imagesMicCouponIcon, width: 40.w, height: 40.w , ), @@ -248,14 +242,14 @@ class _ChatCouponItemState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - "视频详情直播间送礼物", + widget.item.type == 1 ? "主动发起聊天" : "主动发起连麦", style: TextStyle( fontSize: 13.w, fontWeight: FontWeight.w500 ), ), Text( - "2025-11-03 17:55:55", + "${widget.item.startTime}", style: TextStyle( fontSize: 11.w, color: const Color.fromRGBO(144, 144, 144, 1) @@ -270,14 +264,14 @@ class _ChatCouponItemState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - "主动发消息", + widget.item.type == 1 ? "主动发起聊天" : "主动发起连麦", style: TextStyle( fontSize: 13.w, color: const Color.fromRGBO(144, 144, 144, 1) ), ), Text( - "-1张", + "-${widget.item.num}张", style: TextStyle( fontSize: 13.w, color: const Color.fromRGBO(227, 84, 84, 1)