mod: show hot label

Closes #683

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-15 12:27:39 +08:00
parent 54ba05c4aa
commit 2d0d578bb4

View File

@@ -126,79 +126,111 @@ class _VideoInfoState extends State<VideoInfo> {
late final _horizontalMemberPage = GStorage.horizontalMemberPage; late final _horizontalMemberPage = GStorage.horizontalMemberPage;
Widget _buildVideoTitle([bool isExpand = false]) => videoDetailCtr Widget _buildVideoTitle([bool isExpand = false]) => Obx(
.enableSponsorBlock () => Text.rich(
? Obx( TextSpan(
() => Text.rich( children: [
TextSpan( if (videoIntroController.videoDetail.value.honorReply?.honor
children: [ ?.any((item) => item.type == 7) ==
if (videoDetailCtr.videoLabel.value.isNotEmpty) ...[ true) ...[
WidgetSpan( WidgetSpan(
alignment: PlaceholderAlignment.middle, alignment: PlaceholderAlignment.middle,
child: Container( child: Container(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.only(
horizontal: 4, left: 6, right: 8, top: 2, bottom: 2),
vertical: 2, decoration: BoxDecoration(
), color: Theme.of(context).colorScheme.secondaryContainer,
decoration: BoxDecoration( borderRadius: BorderRadius.circular(20),
color: Theme.of(context).colorScheme.secondaryContainer, ),
borderRadius: BorderRadius.circular(4), child: Row(
), mainAxisSize: MainAxisSize.min,
child: Row( children: [
mainAxisSize: MainAxisSize.min, Icon(
children: [ MdiIcons.fire,
Stack( size: 16,
alignment: Alignment.center, color: Theme.of(context)
children: [ .colorScheme
Icon( .onSecondaryContainer,
Icons.shield_outlined, ),
size: 16, Text(
color: Theme.of(context) '热门',
.colorScheme textScaler: TextScaler.linear(1),
.onSecondaryContainer, strutStyle: StrutStyle(leading: 0, height: 1),
), style: TextStyle(
Icon( height: 1,
Icons.play_arrow_rounded, fontSize: 12,
size: 12, color: Theme.of(context)
color: Theme.of(context) .colorScheme
.colorScheme .onSecondaryContainer,
.onSecondaryContainer,
),
],
), ),
Text( ),
videoDetailCtr.videoLabel.value, ],
textScaler: TextScaler.linear(1), ),
strutStyle: StrutStyle(leading: 0, height: 1), ),
style: TextStyle( ),
height: 1, TextSpan(text: ' '),
fontSize: 13, ],
if (videoDetailCtr.videoLabel.value.isNotEmpty) ...[
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: 4,
vertical: 2,
),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.secondaryContainer,
borderRadius: BorderRadius.circular(4),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Stack(
alignment: Alignment.center,
children: [
Icon(
Icons.shield_outlined,
size: 16,
color: Theme.of(context) color: Theme.of(context)
.colorScheme .colorScheme
.onSecondaryContainer, .onSecondaryContainer,
), ),
Icon(
Icons.play_arrow_rounded,
size: 12,
color: Theme.of(context)
.colorScheme
.onSecondaryContainer,
),
],
),
Text(
videoDetailCtr.videoLabel.value,
textScaler: TextScaler.linear(1),
strutStyle: StrutStyle(leading: 0, height: 1),
style: TextStyle(
height: 1,
fontSize: 13,
color: Theme.of(context)
.colorScheme
.onSecondaryContainer,
), ),
], ),
), ],
), ),
), ),
TextSpan(text: ' '), ),
], TextSpan(text: ' '),
TextSpan(
text: '${videoDetail.title ?? videoItem['title'] ?? ''}'),
], ],
), TextSpan(
maxLines: isExpand ? null : 2, text: '${videoDetail.title ?? videoItem['title'] ?? ''}'),
overflow: isExpand ? null : TextOverflow.ellipsis, ],
style: const TextStyle(fontSize: 16),
), ),
)
: Text(
'${videoDetail.title ?? videoItem['title'] ?? ''}',
maxLines: isExpand ? null : 2, maxLines: isExpand ? null : 2,
overflow: isExpand ? null : TextOverflow.ellipsis, overflow: isExpand ? null : TextOverflow.ellipsis,
style: const TextStyle(fontSize: 16), style: const TextStyle(fontSize: 16),
); ),
);
void handleState(Future Function() action) async { void handleState(Future Function() action) async {
if (isProcessing.not) { if (isProcessing.not) {