|
|
|
@ -4,6 +4,8 @@ import 'package:flutter/material.dart'; |
|
|
|
import 'package:get/get.dart'; |
|
|
|
import 'package:dating_touchme_app/model/home/marriage_data.dart'; |
|
|
|
import 'package:dating_touchme_app/pages/home/user_information_page.dart'; |
|
|
|
import 'package:dating_touchme_app/pages/message/chat_page.dart'; |
|
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; |
|
|
|
|
|
|
|
// 通用头部组件:头像/昵称/在线/认证/Hi/直播中徽标 |
|
|
|
class _CardHeader extends StatelessWidget { |
|
|
|
@ -12,7 +14,7 @@ class _CardHeader extends StatelessWidget { |
|
|
|
|
|
|
|
@override |
|
|
|
Widget build(BuildContext context) { |
|
|
|
final bool isLive = true; //item.isLive ?? false; |
|
|
|
final bool isLive = item.isLive; |
|
|
|
final bool isOnline = true; //item.isOnline ?? false; |
|
|
|
|
|
|
|
return Row( |
|
|
|
@ -222,23 +224,46 @@ class _CardHeader extends StatelessWidget { |
|
|
|
), |
|
|
|
// 根据不同状态显示不同按钮 - 都放在HI按钮相同位置 |
|
|
|
InkWell( |
|
|
|
onTap: () { |
|
|
|
onTap: () async { |
|
|
|
// 点击事件处理 |
|
|
|
if (isLive) { |
|
|
|
// 进入直播间逻辑 |
|
|
|
print('进入直播间'); |
|
|
|
} else if (isOnline) { |
|
|
|
// HI按钮点击逻辑 |
|
|
|
print('HI点击'); |
|
|
|
// HI按钮点击逻辑 - 跳转到聊天页面 |
|
|
|
try { |
|
|
|
if (item.userId.isEmpty) { |
|
|
|
SmartDialog.showToast('用户ID不存在,无法发送消息'); |
|
|
|
return; |
|
|
|
} |
|
|
|
await Get.to(() => ChatPage( |
|
|
|
userId: item.userId, |
|
|
|
userData: item, |
|
|
|
)); |
|
|
|
} catch (e) { |
|
|
|
print('❌ [ContentCard] 跳转聊天页面失败: $e'); |
|
|
|
SmartDialog.showToast('跳转失败,请重试'); |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 发消息按钮点击逻辑 |
|
|
|
print('发送消息'); |
|
|
|
// 发消息按钮点击逻辑 - 跳转到聊天页面 |
|
|
|
try { |
|
|
|
if (item.userId.isEmpty) { |
|
|
|
SmartDialog.showToast('用户ID不存在,无法发送消息'); |
|
|
|
return; |
|
|
|
} |
|
|
|
await Get.to(() => ChatPage( |
|
|
|
userId: item.userId, |
|
|
|
userData: item, |
|
|
|
)); |
|
|
|
} catch (e) { |
|
|
|
print('❌ [ContentCard] 跳转聊天页面失败: $e'); |
|
|
|
SmartDialog.showToast('跳转失败,请重试'); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
child: Image.asset( |
|
|
|
_getButtonImage(), |
|
|
|
// width: (item.isLive ?? false) ? 60 : 40, |
|
|
|
width: (true) ? 60 : 40, |
|
|
|
_getButtonImage(isLive, isOnline), |
|
|
|
width: isLive ? 60 : 40, |
|
|
|
height: 20, |
|
|
|
), |
|
|
|
), |
|
|
|
@ -246,17 +271,14 @@ class _CardHeader extends StatelessWidget { |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
String _getButtonImage() { |
|
|
|
// if (item.isLive ?? false) { |
|
|
|
// return Assets.imagesLiveIcon; // 直播显示直播间按钮(放在HI位置) |
|
|
|
// } else if (item.isOnline ?? false) { |
|
|
|
// return Assets.imagesHiIcon; // 在线显示HI按钮 |
|
|
|
// } else { |
|
|
|
// return Assets.imagesSendMessageIcon; // 下线显示发消息按钮(放在HI位置) |
|
|
|
// } |
|
|
|
// } |
|
|
|
|
|
|
|
return Assets.imagesLiveIcon; // 直播显示直播间按钮(放在HI位置) |
|
|
|
String _getButtonImage(bool isLive, bool isOnline) { |
|
|
|
if (isLive) { |
|
|
|
return Assets.imagesLiveIcon; // 直播显示直播间按钮(放在HI位置) |
|
|
|
} else if (isOnline) { |
|
|
|
return Assets.imagesHiIcon; // 在线显示HI按钮 |
|
|
|
} else { |
|
|
|
return Assets.imagesSendMessageIcon; // 下线显示发消息按钮(放在HI位置) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|