From 5f5387b941084af2e32e11182156e04dde01299d Mon Sep 17 00:00:00 2001 From: bggRGjQaUbCoE Date: Fri, 11 Jul 2025 12:35:41 +0800 Subject: [PATCH] show co/charging label fix special dm Signed-off-by: bggRGjQaUbCoE --- lib/common/widgets/video_card/video_card_h.dart | 14 ++++++++++++-- lib/models/model_hot_video_item.dart | 3 ++- lib/models/search/result.dart | 2 ++ lib/pages/danmaku/controller.dart | 3 +++ lib/pages/episode_panel/view.dart | 13 ++++++++++++- lib/pages/later/widgets/video_card_h_later.dart | 6 ++++++ 6 files changed, 37 insertions(+), 4 deletions(-) diff --git a/lib/common/widgets/video_card/video_card_h.dart b/lib/common/widgets/video_card/video_card_h.dart index b17a9076..0d7ce79c 100644 --- a/lib/common/widgets/video_card/video_card_h.dart +++ b/lib/common/widgets/video_card/video_card_h.dart @@ -38,11 +38,21 @@ class VideoCardH extends StatelessWidget { @override Widget build(BuildContext context) { String type = 'video'; + String? badge; if (videoItem case SearchVideoItemModel item) { var typeOrNull = item.type; if (typeOrNull?.isNotEmpty == true) { type = typeOrNull!; } + if (item.isUnionVideo == 1) { + badge = '合作'; + } + } else if (videoItem case HotVideoItemModel item) { + if (item.isCooperation == 1) { + badge = '合作'; + } else { + badge = item.pgcLabel; + } } return Material( type: MaterialType.transparency, @@ -123,9 +133,9 @@ class VideoCardH extends StatelessWidget { width: maxWidth, height: maxHeight, ), - if (videoItem case HotVideoItemModel item) + if (badge != null) PBadge( - text: item.pgcLabel, + text: badge, top: 6.0, right: 6.0, ), diff --git a/lib/models/model_hot_video_item.dart b/lib/models/model_hot_video_item.dart index 579a7b98..b65c079d 100644 --- a/lib/models/model_hot_video_item.dart +++ b/lib/models/model_hot_video_item.dart @@ -17,8 +17,8 @@ class HotVideoItemModel extends BaseRecVideoItemModel with MultiSelectData { String? pubLocation; String? pgcLabel; String? redirectUrl; - num? progress; + int? isCooperation; HotVideoItemModel.fromJson(Map json) { aid = json["aid"]; @@ -47,6 +47,7 @@ class HotVideoItemModel extends BaseRecVideoItemModel with MultiSelectData { redirectUrl = json['redirect_url']; // uri = json['uri']; // 仅在稍后再看存在 progress = json['progress']; + isCooperation = json['rights']?['is_cooperation']; } // @override diff --git a/lib/models/search/result.dart b/lib/models/search/result.dart index db656398..aaff7e41 100644 --- a/lib/models/search/result.dart +++ b/lib/models/search/result.dart @@ -75,6 +75,7 @@ class SearchVideoItemModel extends BaseVideoItemModel { String? arcurl; String? tag; int? ctime; + int? isUnionVideo; List<({bool isEm, String text})>? titleList; @@ -93,6 +94,7 @@ class SearchVideoItemModel extends BaseVideoItemModel { duration = DurationUtil.parseDuration(json['duration']); owner = SearchOwner.fromJson(json); stat = SearchStat.fromJson(json); + isUnionVideo = json['is_union_video']; } } diff --git a/lib/pages/danmaku/controller.dart b/lib/pages/danmaku/controller.dart index 1fe4f8db..243490c5 100644 --- a/lib/pages/danmaku/controller.dart +++ b/lib/pages/danmaku/controller.dart @@ -57,6 +57,9 @@ class PlDanmakuController { final shouldFilter = plPlayerController.filters.count != 0; for (final element in data.elems) { + if (element.mode == 7 && !plPlayerController.showSpecialDanmaku) { + continue; + } if (accountService.isLogin.value) { element.isSelf = element.midHash == plPlayerController.midHash; } diff --git a/lib/pages/episode_panel/view.dart b/lib/pages/episode_panel/view.dart index 2dea5411..cecdf0c8 100644 --- a/lib/pages/episode_panel/view.dart +++ b/lib/pages/episode_panel/view.dart @@ -340,6 +340,7 @@ class _EpisodePanelState extends CommonSlidePageState { int? pubdate; int? view; int? danmaku; + bool? isCharging; switch (episode) { case Part part: @@ -356,6 +357,9 @@ class _EpisodePanelState extends CommonSlidePageState { pubdate = item.arc?.pubdate; view = item.arc?.stat?.view; danmaku = item.arc?.stat?.danmaku; + if (item.attribute == 8) { + isCharging = true; + } break; case pgc.EpisodeItem item: bvid = item.bvid; @@ -445,7 +449,14 @@ class _EpisodePanelState extends CommonSlidePageState { bottom: 6.0, type: PBadgeType.gray, ), - if (episode.badge != null) + if (isCharging == true) + const PBadge( + text: '充电专属', + top: 6, + right: 6, + type: PBadgeType.error, + ) + else if (episode.badge != null) PBadge( text: episode.badge, top: 6, diff --git a/lib/pages/later/widgets/video_card_h_later.dart b/lib/pages/later/widgets/video_card_h_later.dart index eb7cab04..a491c233 100644 --- a/lib/pages/later/widgets/video_card_h_later.dart +++ b/lib/pages/later/widgets/video_card_h_later.dart @@ -101,6 +101,12 @@ class VideoCardHLater extends StatelessWidget { right: 6.0, type: PBadgeType.error, ) + else if (videoItem.rights?.isCooperation == 1) + const PBadge( + text: '合作', + top: 6.0, + right: 6.0, + ) else if (videoItem.pgcLabel != null) PBadge( text: videoItem.pgcLabel,