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;
Widget _buildVideoTitle([bool isExpand = false]) => videoDetailCtr
.enableSponsorBlock
? Obx(
() => Text.rich(
TextSpan(
children: [
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)
.colorScheme
.onSecondaryContainer,
),
Icon(
Icons.play_arrow_rounded,
size: 12,
color: Theme.of(context)
.colorScheme
.onSecondaryContainer,
),
],
Widget _buildVideoTitle([bool isExpand = false]) => Obx(
() => Text.rich(
TextSpan(
children: [
if (videoIntroController.videoDetail.value.honorReply?.honor
?.any((item) => item.type == 7) ==
true) ...[
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: Container(
padding: const EdgeInsets.only(
left: 6, right: 8, top: 2, bottom: 2),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.secondaryContainer,
borderRadius: BorderRadius.circular(20),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
MdiIcons.fire,
size: 16,
color: Theme.of(context)
.colorScheme
.onSecondaryContainer,
),
Text(
'热门',
textScaler: TextScaler.linear(1),
strutStyle: StrutStyle(leading: 0, height: 1),
style: TextStyle(
height: 1,
fontSize: 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,
),
],
),
),
),
TextSpan(text: ' '),
],
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)
.colorScheme
.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: '${videoDetail.title ?? videoItem['title'] ?? ''}'),
),
TextSpan(text: ' '),
],
),
maxLines: isExpand ? null : 2,
overflow: isExpand ? null : TextOverflow.ellipsis,
style: const TextStyle(fontSize: 16),
TextSpan(
text: '${videoDetail.title ?? videoItem['title'] ?? ''}'),
],
),
)
: Text(
'${videoDetail.title ?? videoItem['title'] ?? ''}',
maxLines: isExpand ? null : 2,
overflow: isExpand ? null : TextOverflow.ellipsis,
style: const TextStyle(fontSize: 16),
);
),
);
void handleState(Future Function() action) async {
if (isProcessing.not) {