diff --git a/lib/models_new/live/live_superchat/item.dart b/lib/models_new/live/live_superchat/item.dart index c0b72d613..c45039be7 100644 --- a/lib/models_new/live/live_superchat/item.dart +++ b/lib/models_new/live/live_superchat/item.dart @@ -14,7 +14,8 @@ class SuperChatItem { String token; int ts; UserInfo userInfo; - bool expired = false; + late bool expired = false; + late bool deleted = false; SuperChatItem({ required this.id, diff --git a/lib/pages/live_room/controller.dart b/lib/pages/live_room/controller.dart index 373e23a3d..665d867c0 100644 --- a/lib/pages/live_room/controller.dart +++ b/lib/pages/live_room/controller.dart @@ -518,6 +518,25 @@ class LiveRoomController extends GetxController { } addDm(item); break; + case 'SUPER_CHAT_MESSAGE_DELETE' when showSuperChat: + if (obj['roomid'] == roomId) { + final ids = obj['data']?['ids'] as List?; + if (ids != null && ids.isNotEmpty) { + if (superChatType == .valid) { + superChatMsg.removeWhere((e) => ids.contains(e.id)); + } else { + bool? refresh; + for (final id in ids) { + final item = superChatMsg.firstWhereOrNull((e) => e.id == id); + item?.deleted = true; + refresh ??= true; + } + if (refresh ?? false) { + superChatMsg.refresh(); + } + } + } + } case 'WATCHED_CHANGE': watchedShow.value = obj['data']['text_large']; break; diff --git a/lib/pages/live_room/superchat/superchat_card.dart b/lib/pages/live_room/superchat/superchat_card.dart index feec5e892..6017a925f 100644 --- a/lib/pages/live_room/superchat/superchat_card.dart +++ b/lib/pages/live_room/superchat/superchat_card.dart @@ -141,9 +141,7 @@ class _SuperChatCardState extends State { onSecondaryTapUp: PlatformUtils.isDesktop ? showMenu : null, child: Container( decoration: BoxDecoration( - borderRadius: const BorderRadius.vertical( - top: Radius.circular(8), - ), + borderRadius: const .vertical(top: .circular(8)), color: Utils.parseColor(item.backgroundColor), border: Border(top: border, left: border, right: border), ), @@ -193,16 +191,22 @@ class _SuperChatCardState extends State { ), Container( decoration: BoxDecoration( - borderRadius: const BorderRadius.vertical( - bottom: Radius.circular(8), - ), + borderRadius: const .vertical(bottom: .circular(8)), color: bottomColor, ), padding: const EdgeInsets.all(8), child: SelectionArea( child: Text( item.message, - style: TextStyle(color: Utils.parseColor(item.messageFontColor)), + style: TextStyle( + color: Utils.parseColor(item.messageFontColor), + decoration: !widget.persistentSC && item.deleted + ? .lineThrough + : null, + decorationThickness: 1.5, + decorationStyle: .double, + decorationColor: Colors.white, + ), ), ), ),