18 changed files with 402 additions and 27 deletions
Split View
Diff Options
-
BINassets/images/connect_history_icon.png
-
11lib/controller/home/user_information_controller.dart
-
1lib/controller/message/chat_settings_controller.dart
-
60lib/controller/message/connect_history_controller.dart
-
2lib/controller/mine/edit_info_controller.dart
-
1lib/generated/assets.dart
-
104lib/model/mine/connect_history_data.dart
-
4lib/network/api_urls.dart
-
7lib/network/user_api.dart
-
43lib/network/user_api.g.dart
-
2lib/pages/discover/visitor_list_page.dart
-
2lib/pages/home/content_card.dart
-
7lib/pages/home/user_information_page.dart
-
1lib/pages/message/chat_page.dart
-
117lib/pages/message/connect_history_page.dart
-
39lib/pages/message/conversation_tab.dart
-
4lib/pages/mine/my_friend_page.dart
-
24lib/rtc/rtc_manager.dart
@ -0,0 +1,60 @@ |
|||
|
|||
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 '../../model/mine/connect_history_data.dart'; |
|||
|
|||
class ConnectHistoryController extends GetxController { |
|||
|
|||
late UserApi _userApi; |
|||
|
|||
final historyList = <Records>[].obs; |
|||
|
|||
|
|||
final page = 1.obs; |
|||
|
|||
final hasMore = true.obs; |
|||
|
|||
late final EasyRefreshController listRefreshController; |
|||
|
|||
@override |
|||
void onInit() { |
|||
super.onInit(); |
|||
listRefreshController = EasyRefreshController( |
|||
controlFinishRefresh: true, |
|||
controlFinishLoad: true, |
|||
); |
|||
_userApi = Get.find<UserApi>(); |
|||
getHistoryList(); |
|||
} |
|||
|
|||
getHistoryList() async {try{ |
|||
final response = await _userApi.userPageLatestDatingRecord( |
|||
pageNum: page.value, |
|||
pageSize: 10, |
|||
); |
|||
if (response.data.isSuccess && response.data.data != null) { |
|||
final data = response.data.data?.records ?? []; |
|||
|
|||
historyList.addAll(data.toList()); |
|||
if((data.length ?? 0) == 10){ |
|||
|
|||
listRefreshController.finishLoad(IndicatorResult.success); |
|||
} else { |
|||
listRefreshController.finishLoad(IndicatorResult.noMore); |
|||
} |
|||
} else { |
|||
|
|||
// 响应失败,抛出异常 |
|||
throw Exception(response.data.message ?? '获取数据失败'); |
|||
} |
|||
} catch(e) { |
|||
print('连麦记录获取失败: $e'); |
|||
SmartDialog.showToast('连麦记录获取失败'); |
|||
rethrow; |
|||
} |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,104 @@ |
|||
class ConnectHistoryData { |
|||
List<Records>? records; |
|||
int? total; |
|||
int? size; |
|||
int? current; |
|||
int? pages; |
|||
|
|||
ConnectHistoryData( |
|||
{this.records, this.total, this.size, this.current, this.pages}); |
|||
|
|||
ConnectHistoryData.fromJson(Map<String, dynamic> json) { |
|||
if (json['records'] != null) { |
|||
records = <Records>[]; |
|||
json['records'].forEach((v) { |
|||
records!.add(new Records.fromJson(v)); |
|||
}); |
|||
} |
|||
total = json['total']; |
|||
size = json['size']; |
|||
current = json['current']; |
|||
pages = json['pages']; |
|||
} |
|||
|
|||
Map<String, dynamic> toJson() { |
|||
final Map<String, dynamic> data = new Map<String, dynamic>(); |
|||
if (this.records != null) { |
|||
data['records'] = this.records!.map((v) => v.toJson()).toList(); |
|||
} |
|||
data['total'] = this.total; |
|||
data['size'] = this.size; |
|||
data['current'] = this.current; |
|||
data['pages'] = this.pages; |
|||
return data; |
|||
} |
|||
} |
|||
|
|||
class Records { |
|||
String? createTime; |
|||
String? anchorMiId; |
|||
String? anchorProfilePhoto; |
|||
String? anchorNickName; |
|||
String? dateObjectMiId; |
|||
String? dateObjectProfilePhoto; |
|||
String? dateObjectNickName; |
|||
int? dateObjectProvinceCode; |
|||
String? dateObjectProvinceName; |
|||
int? dateObjectCityCode; |
|||
String? dateObjectCityName; |
|||
String? dateObjectBirthYear; |
|||
String? dateObjectBirthDate; |
|||
int? dateObjectAge; |
|||
|
|||
Records( |
|||
{this.createTime, |
|||
this.anchorMiId, |
|||
this.anchorProfilePhoto, |
|||
this.anchorNickName, |
|||
this.dateObjectMiId, |
|||
this.dateObjectProfilePhoto, |
|||
this.dateObjectNickName, |
|||
this.dateObjectProvinceCode, |
|||
this.dateObjectProvinceName, |
|||
this.dateObjectCityCode, |
|||
this.dateObjectCityName, |
|||
this.dateObjectBirthYear, |
|||
this.dateObjectBirthDate, |
|||
this.dateObjectAge}); |
|||
|
|||
Records.fromJson(Map<String, dynamic> json) { |
|||
createTime = json['createTime']; |
|||
anchorMiId = json['anchorMiId']; |
|||
anchorProfilePhoto = json['anchorProfilePhoto']; |
|||
anchorNickName = json['anchorNickName']; |
|||
dateObjectMiId = json['dateObjectMiId']; |
|||
dateObjectProfilePhoto = json['dateObjectProfilePhoto']; |
|||
dateObjectNickName = json['dateObjectNickName']; |
|||
dateObjectProvinceCode = json['dateObjectProvinceCode']; |
|||
dateObjectProvinceName = json['dateObjectProvinceName']; |
|||
dateObjectCityCode = json['dateObjectCityCode']; |
|||
dateObjectCityName = json['dateObjectCityName']; |
|||
dateObjectBirthYear = json['dateObjectBirthYear']; |
|||
dateObjectBirthDate = json['dateObjectBirthDate']; |
|||
dateObjectAge = json['dateObjectAge']; |
|||
} |
|||
|
|||
Map<String, dynamic> toJson() { |
|||
final Map<String, dynamic> data = new Map<String, dynamic>(); |
|||
data['createTime'] = this.createTime; |
|||
data['anchorMiId'] = this.anchorMiId; |
|||
data['anchorProfilePhoto'] = this.anchorProfilePhoto; |
|||
data['anchorNickName'] = this.anchorNickName; |
|||
data['dateObjectMiId'] = this.dateObjectMiId; |
|||
data['dateObjectProfilePhoto'] = this.dateObjectProfilePhoto; |
|||
data['dateObjectNickName'] = this.dateObjectNickName; |
|||
data['dateObjectProvinceCode'] = this.dateObjectProvinceCode; |
|||
data['dateObjectProvinceName'] = this.dateObjectProvinceName; |
|||
data['dateObjectCityCode'] = this.dateObjectCityCode; |
|||
data['dateObjectCityName'] = this.dateObjectCityName; |
|||
data['dateObjectBirthYear'] = this.dateObjectBirthYear; |
|||
data['dateObjectBirthDate'] = this.dateObjectBirthDate; |
|||
data['dateObjectAge'] = this.dateObjectAge; |
|||
return data; |
|||
} |
|||
} |
|||
@ -0,0 +1,117 @@ |
|||
import 'package:cached_network_image/cached_network_image.dart'; |
|||
import 'package:dating_touchme_app/components/page_appbar.dart'; |
|||
import 'package:dating_touchme_app/controller/message/connect_history_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/connect_history_data.dart'; |
|||
import 'package:dating_touchme_app/pages/home/user_information_page.dart'; |
|||
import 'package:flutter/material.dart'; |
|||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|||
import 'package:get/get.dart'; |
|||
|
|||
class ConnectHistoryPage extends StatelessWidget { |
|||
const ConnectHistoryPage({super.key}); |
|||
|
|||
@override |
|||
Widget build(BuildContext context) { |
|||
return GetX<ConnectHistoryController>( |
|||
init: ConnectHistoryController(), |
|||
builder: (controller){ |
|||
return Scaffold( |
|||
appBar: PageAppbar(title: "连线记录"), |
|||
body: SingleChildScrollView( |
|||
child: Container( |
|||
padding: EdgeInsets.symmetric( |
|||
horizontal: 15.w, |
|||
vertical: 10.w |
|||
), |
|||
child: Column( |
|||
children: [ |
|||
...controller.historyList.map((e){ |
|||
return ConnectItem(item: e,); |
|||
}), |
|||
], |
|||
), |
|||
), |
|||
), |
|||
); |
|||
}, |
|||
); |
|||
} |
|||
} |
|||
|
|||
|
|||
class ConnectItem extends StatefulWidget { |
|||
final Records item; |
|||
const ConnectItem({super.key, required this.item}); |
|||
|
|||
@override |
|||
State<ConnectItem> createState() => _ConnectItemState(); |
|||
} |
|||
|
|||
class _ConnectItemState extends State<ConnectItem> { |
|||
@override |
|||
Widget build(BuildContext context) { |
|||
return Container( |
|||
margin: EdgeInsets.only(bottom: 40.w), |
|||
child: Row( |
|||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|||
children: [ |
|||
Row( |
|||
children: [ |
|||
ClipRRect( |
|||
borderRadius: BorderRadius.all(Radius.circular(51.w)), |
|||
child: CachedNetworkImage( |
|||
imageUrl: widget.item.anchorProfilePhoto ?? "", |
|||
width: 51.w, |
|||
height: 51.w, |
|||
fit: BoxFit.cover, |
|||
), |
|||
).onTap((){ |
|||
Get.to(() => UserInformationPage(miId: widget.item.anchorMiId ?? "",)); |
|||
}), |
|||
SizedBox(width: 5.w,), |
|||
ClipRRect( |
|||
borderRadius: BorderRadius.all(Radius.circular(51.w)), |
|||
child: CachedNetworkImage( |
|||
imageUrl: widget.item.dateObjectProfilePhoto ?? "", |
|||
width: 51.w, |
|||
height: 51.w, |
|||
fit: BoxFit.cover, |
|||
), |
|||
).onTap((){ |
|||
Get.to(() => UserInformationPage(miId: widget.item.dateObjectMiId ?? "",)); |
|||
}), |
|||
SizedBox(width: 10.w,), |
|||
Column( |
|||
crossAxisAlignment: CrossAxisAlignment.start, |
|||
children: [ |
|||
Text( |
|||
"${widget.item.dateObjectNickName ?? ""}", |
|||
style: TextStyle( |
|||
fontSize: 13.w |
|||
), |
|||
), |
|||
Text( |
|||
"${widget.item.dateObjectCityName ?? ""} | ${widget.item.dateObjectAge ?? ""}岁", |
|||
style: TextStyle( |
|||
fontSize: 8.w, |
|||
color: const Color.fromRGBO(144, 144, 144, 1) |
|||
), |
|||
) |
|||
], |
|||
) |
|||
], |
|||
), |
|||
Text( |
|||
"${widget.item.createTime ?? ""}", |
|||
style: TextStyle( |
|||
fontSize: 8.w, |
|||
color: const Color.fromRGBO(144, 144, 144, 1) |
|||
), |
|||
) |
|||
], |
|||
), |
|||
); |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save