From f7184aff4e2fa7fa8ae36e4d2674765d3a273d1b Mon Sep 17 00:00:00 2001 From: bggRGjQaUbCoE Date: Fri, 18 Jul 2025 18:32:12 +0800 Subject: [PATCH] show video label Signed-off-by: bggRGjQaUbCoE --- lib/pages/member_coin_arc/widgets/item.dart | 12 +++ .../widgets/video_card_v_member_home.dart | 23 ++++++ lib/pages/video/introduction/ugc/view.dart | 79 ++++++++++++------- 3 files changed, 86 insertions(+), 28 deletions(-) diff --git a/lib/pages/member_coin_arc/widgets/item.dart b/lib/pages/member_coin_arc/widgets/item.dart index dafca4fdb..9c8a386ac 100644 --- a/lib/pages/member_coin_arc/widgets/item.dart +++ b/lib/pages/member_coin_arc/widgets/item.dart @@ -71,6 +71,18 @@ class MemberCoinLikeItem extends StatelessWidget { height: maxHeight, radius: 0, ), + if (item.isCooperation == true) + const PBadge( + text: '合作', + top: 6, + right: 6, + ) + else if (item.isSteins == true) + const PBadge( + text: '互动', + top: 6, + right: 6, + ), if (item.duration != null && item.duration! > 0) PBadge( bottom: 6, diff --git a/lib/pages/member_home/widgets/video_card_v_member_home.dart b/lib/pages/member_home/widgets/video_card_v_member_home.dart index 607cd603e..33413991c 100644 --- a/lib/pages/member_home/widgets/video_card_v_member_home.dart +++ b/lib/pages/member_home/widgets/video_card_v_member_home.dart @@ -99,7 +99,30 @@ class VideoCardVMemberHome extends StatelessWidget { size: PBadgeSize.small, type: PBadgeType.gray, text: DurationUtil.formatDuration(videoItem.duration), + ), + if (videoItem.badges?.isNotEmpty == true) + PBadge( + text: videoItem.badges! + .map((e) => e.text ?? '') + .join('|'), + top: 6, + right: 6, + type: videoItem.badges!.first.text == '充电专属' + ? PBadgeType.error + : PBadgeType.primary, ) + else if (videoItem.isCooperation == true) + const PBadge( + text: '合作', + top: 6, + right: 6, + ) + else if (videoItem.isSteins == true) + const PBadge( + text: '互动', + top: 6, + right: 6, + ), ], ); }, diff --git a/lib/pages/video/introduction/ugc/view.dart b/lib/pages/video/introduction/ugc/view.dart index dc38ea681..37826a770 100644 --- a/lib/pages/video/introduction/ugc/view.dart +++ b/lib/pages/video/introduction/ugc/view.dart @@ -132,6 +132,37 @@ class _VideoInfoState extends State { late final _horizontalMemberPage = Pref.horizontalMemberPage; + WidgetSpan _labelWidget(String text, Color bgColor, Color textColor) { + return WidgetSpan( + alignment: PlaceholderAlignment.middle, + child: Container( + padding: const EdgeInsets.symmetric( + horizontal: 4, + vertical: 3, + ), + decoration: BoxDecoration( + color: bgColor, + borderRadius: const BorderRadius.all(Radius.circular(4)), + ), + child: Text( + text, + textScaler: TextScaler.noScaling, + strutStyle: const StrutStyle( + leading: 0, + height: 1, + fontSize: 12, + ), + style: TextStyle( + height: 1, + fontSize: 12, + fontWeight: FontWeight.bold, + color: textColor, + ), + ), + ), + ); + } + Widget _buildVideoTitle(ThemeData theme, [bool isExpand = false]) { late final isDark = theme.brightness == Brightness.dark; Widget child() => Text.rich( @@ -171,7 +202,11 @@ class _VideoInfoState extends State { Text( videoDetailCtr.videoLabel.value, textScaler: TextScaler.noScaling, - strutStyle: const StrutStyle(leading: 0, height: 1), + strutStyle: const StrutStyle( + leading: 0, + height: 1, + fontSize: 13, + ), style: TextStyle( height: 1, fontSize: 13, @@ -185,33 +220,21 @@ class _VideoInfoState extends State { const TextSpan(text: ' '), ], if (videoDetail.isUpowerExclusive == true) ...[ - WidgetSpan( - alignment: PlaceholderAlignment.middle, - child: Container( - padding: const EdgeInsets.symmetric( - horizontal: 4, - vertical: 2, - ), - decoration: BoxDecoration( - color: isDark - ? theme.colorScheme.error - : theme.colorScheme.errorContainer, - borderRadius: const BorderRadius.all(Radius.circular(4)), - ), - child: Text( - '充电专属', - textScaler: TextScaler.noScaling, - strutStyle: const StrutStyle(leading: 0, height: 1), - style: TextStyle( - height: 1, - fontSize: 12, - fontWeight: FontWeight.bold, - color: isDark - ? theme.colorScheme.onError - : theme.colorScheme.onErrorContainer, - ), - ), - ), + _labelWidget( + '充电专属', + isDark + ? theme.colorScheme.error + : theme.colorScheme.errorContainer, + isDark + ? theme.colorScheme.onError + : theme.colorScheme.onErrorContainer, + ), + const TextSpan(text: ' '), + ] else if (videoDetail.rights?.isSteinGate == 1) ...[ + _labelWidget( + '互动视频', + theme.colorScheme.secondaryContainer, + theme.colorScheme.onSecondaryContainer, ), const TextSpan(text: ' '), ],