show video label

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-07-18 18:32:12 +08:00
parent 473515efc5
commit f7184aff4e
3 changed files with 86 additions and 28 deletions

View File

@@ -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,

View File

@@ -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,
),
],
);
},

View File

@@ -132,6 +132,37 @@ class _VideoInfoState extends State<VideoInfo> {
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<VideoInfo> {
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<VideoInfo> {
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: ' '),
],