Browse Source

feat(live): 实现礼物弹窗时刷新玫瑰数量功能

- 将多个礼物弹窗方法改为异步函数以支持数据刷新
- 在礼物弹窗显示前调用虚拟账户信息更新接口
- 修复房间控制器中直播状态检查逻辑
- 在消费成功后自动刷新玫瑰数量显示
master
Jolie 3 months ago
parent
commit
b7bf36307c
4 changed files with 14 additions and 7 deletions
  1. 7
      lib/controller/discover/room_controller.dart
  2. 4
      lib/pages/discover/live_room_page.dart
  3. 5
      lib/widget/live/live_room_anchor_showcase.dart
  4. 5
      lib/widget/live/live_room_chat_item.dart

7
lib/controller/discover/room_controller.dart

@ -334,10 +334,6 @@ class RoomController extends GetxController with WidgetsBindingObserver {
}
Future<void> leaveChannel() async {
if(!isLive.value){
//
return;
}
// RTC
if (currentRole == CurrentRole.broadcaster) {
try {
@ -440,6 +436,9 @@ class RoomController extends GetxController with WidgetsBindingObserver {
return;
}
//
await getVirtualAccount();
//
final svgaManager = SvgaPlayerManager.instance;
svgaManager.addToQueue(

4
lib/pages/discover/live_room_page.dart

@ -177,9 +177,11 @@ class _LiveRoomPageState extends State<LiveRoomPage> {
message = '';
}
void _showGiftPopup() {
void _showGiftPopup() async {
//
FocusScope.of(context).unfocus();
//
await _roomController.getVirtualAccount();
SmartDialog.show(
alignment: Alignment.bottomCenter,
maskColor: TDTheme.of(context).fontGyColor2,

5
lib/widget/live/live_room_anchor_showcase.dart

@ -387,7 +387,7 @@ class _LiveRoomAnchorShowcaseState extends State<LiveRoomAnchorShowcase> {
);
}
void _showGiftPopupForUser(RtcSeatUserInfo? userInfo, int type) {
void _showGiftPopupForUser(RtcSeatUserInfo? userInfo, int type) async {
if (userInfo == null) {
return;
}
@ -400,6 +400,9 @@ class _LiveRoomAnchorShowcaseState extends State<LiveRoomAnchorShowcase> {
return;
}
//
await _roomController.getVirtualAccount();
// ValueNotifier
final activeGift = ValueNotifier<int?>(null);
final giftNum = ValueNotifier<int>(1);

5
lib/widget/live/live_room_chat_item.dart

@ -16,9 +16,12 @@ class LiveRoomChatItem extends StatelessWidget {
final LiveChatMessage message;
void _showGiftPopup(BuildContext context, int type) {
void _showGiftPopup(BuildContext context, int type) async {
final roomController = Get.find<RoomController>();
//
await roomController.getVirtualAccount();
// userId
int? targetUid = message.uid;

Loading…
Cancel
Save