|
|
|
@ -4,6 +4,7 @@ import 'package:dating_touchme_app/extension/ex_widget.dart'; |
|
|
|
import 'package:dating_touchme_app/generated/assets.dart'; |
|
|
|
import 'package:dating_touchme_app/model/rtc/rtc_channel_detail.dart'; |
|
|
|
import 'package:dating_touchme_app/rtc/rtc_manager.dart'; |
|
|
|
import 'package:dating_touchme_app/widget/live/live_gift_popup.dart'; |
|
|
|
import 'package:dating_touchme_app/widget/live/live_room_guest_list_dialog.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
@ -69,11 +70,20 @@ class _LiveRoomAnchorShowcaseState extends State<LiveRoomAnchorShowcase> { |
|
|
|
color: const Color.fromRGBO(0, 0, 0, .3), |
|
|
|
), |
|
|
|
child: Center( |
|
|
|
child: Image.asset( |
|
|
|
Assets.imagesGiftIcon, |
|
|
|
width: 19.w, |
|
|
|
height: 19.w, |
|
|
|
), |
|
|
|
child: |
|
|
|
Image.asset( |
|
|
|
Assets.imagesGiftIcon, |
|
|
|
width: 19.w, |
|
|
|
height: 19.w, |
|
|
|
).onTap(() { |
|
|
|
final anchorInfo = _roomController |
|
|
|
.rtcChannelDetail |
|
|
|
.value |
|
|
|
?.anchorInfo; |
|
|
|
if (anchorInfo != null) { |
|
|
|
_showGiftPopupForUser(anchorInfo); |
|
|
|
} |
|
|
|
}), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
@ -221,11 +231,14 @@ class _LiveRoomAnchorShowcaseState extends State<LiveRoomAnchorShowcase> { |
|
|
|
), |
|
|
|
), |
|
|
|
child: Center( |
|
|
|
child: Image.asset( |
|
|
|
Assets.imagesGiftIcon, |
|
|
|
width: 19.w, |
|
|
|
height: 19.w, |
|
|
|
), |
|
|
|
child: |
|
|
|
Image.asset( |
|
|
|
Assets.imagesGiftIcon, |
|
|
|
width: 19.w, |
|
|
|
height: 19.w, |
|
|
|
).onTap(() { |
|
|
|
_showGiftPopupForUser(userInfo); |
|
|
|
}), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
@ -341,4 +354,49 @@ class _LiveRoomAnchorShowcaseState extends State<LiveRoomAnchorShowcase> { |
|
|
|
}, |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
void _showGiftPopupForUser(RtcSeatUserInfo? userInfo) { |
|
|
|
if (userInfo == null) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// 获取目标用户ID(优先使用userId,如果没有则使用miId) |
|
|
|
final targetUserId = userInfo.userId.isNotEmpty |
|
|
|
? userInfo.userId |
|
|
|
: userInfo.miId.isNotEmpty |
|
|
|
? userInfo.miId |
|
|
|
: null; |
|
|
|
|
|
|
|
if (targetUserId == null) { |
|
|
|
SmartDialog.showToast('用户ID不存在'); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// 创建必要的 ValueNotifier |
|
|
|
final activeGift = ValueNotifier<int?>(null); |
|
|
|
final giftNum = ValueNotifier<int>(1); |
|
|
|
|
|
|
|
SmartDialog.show( |
|
|
|
alignment: Alignment.bottomCenter, |
|
|
|
maskColor: Colors.black.withOpacity(0.5), |
|
|
|
builder: (context) { |
|
|
|
return Obx(() { |
|
|
|
// 获取礼物列表 |
|
|
|
final giftProducts = _roomController.giftProducts; |
|
|
|
final giftList = giftProducts.toList(); |
|
|
|
|
|
|
|
return LiveGiftPopup( |
|
|
|
activeGift: activeGift, |
|
|
|
giftNum: giftNum, |
|
|
|
giftList: giftList, |
|
|
|
changeActive: (index) { |
|
|
|
activeGift.value = index; |
|
|
|
}, |
|
|
|
showHeader: false, // 不显示头部 |
|
|
|
targetUserId: targetUserId, // 设置目标用户ID |
|
|
|
); |
|
|
|
}); |
|
|
|
}, |
|
|
|
); |
|
|
|
} |
|
|
|
} |