show co/charging label

fix special dm

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-07-11 12:35:41 +08:00
parent db682066ba
commit 5f5387b941
6 changed files with 37 additions and 4 deletions

View File

@@ -38,11 +38,21 @@ class VideoCardH extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
String type = 'video'; String type = 'video';
String? badge;
if (videoItem case SearchVideoItemModel item) { if (videoItem case SearchVideoItemModel item) {
var typeOrNull = item.type; var typeOrNull = item.type;
if (typeOrNull?.isNotEmpty == true) { if (typeOrNull?.isNotEmpty == true) {
type = typeOrNull!; type = typeOrNull!;
} }
if (item.isUnionVideo == 1) {
badge = '合作';
}
} else if (videoItem case HotVideoItemModel item) {
if (item.isCooperation == 1) {
badge = '合作';
} else {
badge = item.pgcLabel;
}
} }
return Material( return Material(
type: MaterialType.transparency, type: MaterialType.transparency,
@@ -123,9 +133,9 @@ class VideoCardH extends StatelessWidget {
width: maxWidth, width: maxWidth,
height: maxHeight, height: maxHeight,
), ),
if (videoItem case HotVideoItemModel item) if (badge != null)
PBadge( PBadge(
text: item.pgcLabel, text: badge,
top: 6.0, top: 6.0,
right: 6.0, right: 6.0,
), ),

View File

@@ -17,8 +17,8 @@ class HotVideoItemModel extends BaseRecVideoItemModel with MultiSelectData {
String? pubLocation; String? pubLocation;
String? pgcLabel; String? pgcLabel;
String? redirectUrl; String? redirectUrl;
num? progress; num? progress;
int? isCooperation;
HotVideoItemModel.fromJson(Map<String, dynamic> json) { HotVideoItemModel.fromJson(Map<String, dynamic> json) {
aid = json["aid"]; aid = json["aid"];
@@ -47,6 +47,7 @@ class HotVideoItemModel extends BaseRecVideoItemModel with MultiSelectData {
redirectUrl = json['redirect_url']; redirectUrl = json['redirect_url'];
// uri = json['uri']; // 仅在稍后再看存在 // uri = json['uri']; // 仅在稍后再看存在
progress = json['progress']; progress = json['progress'];
isCooperation = json['rights']?['is_cooperation'];
} }
// @override // @override

View File

@@ -75,6 +75,7 @@ class SearchVideoItemModel extends BaseVideoItemModel {
String? arcurl; String? arcurl;
String? tag; String? tag;
int? ctime; int? ctime;
int? isUnionVideo;
List<({bool isEm, String text})>? titleList; List<({bool isEm, String text})>? titleList;
@@ -93,6 +94,7 @@ class SearchVideoItemModel extends BaseVideoItemModel {
duration = DurationUtil.parseDuration(json['duration']); duration = DurationUtil.parseDuration(json['duration']);
owner = SearchOwner.fromJson(json); owner = SearchOwner.fromJson(json);
stat = SearchStat.fromJson(json); stat = SearchStat.fromJson(json);
isUnionVideo = json['is_union_video'];
} }
} }

View File

@@ -57,6 +57,9 @@ class PlDanmakuController {
final shouldFilter = plPlayerController.filters.count != 0; final shouldFilter = plPlayerController.filters.count != 0;
for (final element in data.elems) { for (final element in data.elems) {
if (element.mode == 7 && !plPlayerController.showSpecialDanmaku) {
continue;
}
if (accountService.isLogin.value) { if (accountService.isLogin.value) {
element.isSelf = element.midHash == plPlayerController.midHash; element.isSelf = element.midHash == plPlayerController.midHash;
} }

View File

@@ -340,6 +340,7 @@ class _EpisodePanelState extends CommonSlidePageState<EpisodePanel> {
int? pubdate; int? pubdate;
int? view; int? view;
int? danmaku; int? danmaku;
bool? isCharging;
switch (episode) { switch (episode) {
case Part part: case Part part:
@@ -356,6 +357,9 @@ class _EpisodePanelState extends CommonSlidePageState<EpisodePanel> {
pubdate = item.arc?.pubdate; pubdate = item.arc?.pubdate;
view = item.arc?.stat?.view; view = item.arc?.stat?.view;
danmaku = item.arc?.stat?.danmaku; danmaku = item.arc?.stat?.danmaku;
if (item.attribute == 8) {
isCharging = true;
}
break; break;
case pgc.EpisodeItem item: case pgc.EpisodeItem item:
bvid = item.bvid; bvid = item.bvid;
@@ -445,7 +449,14 @@ class _EpisodePanelState extends CommonSlidePageState<EpisodePanel> {
bottom: 6.0, bottom: 6.0,
type: PBadgeType.gray, 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( PBadge(
text: episode.badge, text: episode.badge,
top: 6, top: 6,

View File

@@ -101,6 +101,12 @@ class VideoCardHLater extends StatelessWidget {
right: 6.0, right: 6.0,
type: PBadgeType.error, type: PBadgeType.error,
) )
else if (videoItem.rights?.isCooperation == 1)
const PBadge(
text: '合作',
top: 6.0,
right: 6.0,
)
else if (videoItem.pgcLabel != null) else if (videoItem.pgcLabel != null)
PBadge( PBadge(
text: videoItem.pgcLabel, text: videoItem.pgcLabel,