diff --git a/lib/models_new/live/live_superchat/item.dart b/lib/models_new/live/live_superchat/item.dart index c533a80dd..5b811f483 100644 --- a/lib/models_new/live/live_superchat/item.dart +++ b/lib/models_new/live/live_superchat/item.dart @@ -39,4 +39,32 @@ class SuperChatItem { message: json['message'], userInfo: UserInfo.fromJson(json['user_info'] as Map), ); + + SuperChatItem copyWith({ + int? id, + int? uid, + int? price, + String? backgroundColor, + String? backgroundBottomColor, + String? backgroundPriceColor, + String? messageFontColor, + int? endTime, + String? message, + UserInfo? userInfo, + bool? expired, + }) { + return SuperChatItem( + id: id ?? this.id, + uid: uid ?? this.uid, + price: price ?? this.price, + backgroundColor: backgroundColor ?? this.backgroundColor, + backgroundBottomColor: + backgroundBottomColor ?? this.backgroundBottomColor, + backgroundPriceColor: backgroundPriceColor ?? this.backgroundPriceColor, + messageFontColor: messageFontColor ?? this.messageFontColor, + endTime: endTime ?? this.endTime, + message: message ?? this.message, + userInfo: userInfo ?? this.userInfo, + ); + } } diff --git a/lib/pages/live_room/controller.dart b/lib/pages/live_room/controller.dart index 8bb4c6675..f00b04599 100644 --- a/lib/pages/live_room/controller.dart +++ b/lib/pages/live_room/controller.dart @@ -459,7 +459,9 @@ class LiveRoomController extends GetxController { final item = SuperChatItem.fromJson(obj['data']); superChatMsg.insert(0, item); if (isFullScreen || plPlayerController.isDesktopPip) { - fsSC.value = item; + fsSC.value = item.copyWith( + endTime: DateTime.now().millisecondsSinceEpoch ~/ 1000 + 10, + ); } break; case 'WATCHED_CHANGE':