mod: invalid video style

This commit is contained in:
guozhigq
2024-11-19 23:22:33 +08:00
parent b8affcef05
commit 85ace29282
3 changed files with 55 additions and 8 deletions

View File

@ -1,5 +1,3 @@
import 'dart:developer';
import 'package:pilipala/models/common/invalid_video.dart';
import 'package:pilipala/models/sponsor_block/segment.dart';

View File

@ -19,6 +19,7 @@ class InvalidVideoModel {
final String? videoReview;
final String? favorites;
final String? tag;
final List<String>? tagList;
InvalidVideoModel({
this.id,
@ -41,6 +42,7 @@ class InvalidVideoModel {
this.videoReview,
this.favorites,
this.tag,
this.tagList,
});
factory InvalidVideoModel.fromJson(Map<String, dynamic> json) {
@ -65,6 +67,7 @@ class InvalidVideoModel {
videoReview: json['video_review'],
favorites: json['favorites'],
tag: json['tag'],
tagList: json['tag'].toString().split(',').toList(),
);
}
}

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:pilipala/common/widgets/network_img_layer.dart';
import 'package:pilipala/models/common/invalid_video.dart';
@ -32,15 +33,28 @@ class InvalidVideoCard extends StatelessWidget {
radius: 20,
),
const SizedBox(height: 10),
SelectableText('标题:${videoInfo.title}', style: textStyle),
SelectableText('作者:${videoInfo.author}', style: textStyle),
SelectableText(
videoInfo.title!,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 2),
SelectableText(videoInfo.author!, style: textStyle),
const SizedBox(height: 2),
SelectableText('创建时间:${videoInfo.createdAt}', style: textStyle),
SelectableText('上次更新时间:${videoInfo.lastupdate}',
SelectableText('更新时间:${videoInfo.lastupdate}',
style: textStyle),
SelectableText('分类:${videoInfo.typename}', style: textStyle),
SelectableText('投币:${videoInfo.coins}', style: textStyle),
SelectableText('收藏:${videoInfo.favorites}', style: textStyle),
SelectableText('标签:${videoInfo.tag}', style: textStyle),
SelectableText(
'投币:${videoInfo.coins} 收藏:${videoInfo.favorites}',
style: textStyle),
if (videoInfo.tagList != null &&
videoInfo.tagList!.isNotEmpty) ...[
const SizedBox(height: 6),
_buildTags(context, videoInfo.tagList),
],
],
),
);
@ -48,4 +62,36 @@ class InvalidVideoCard extends StatelessWidget {
),
);
}
Widget _buildTags(BuildContext context, List<String>? videoTags) {
final ColorScheme colorScheme = Theme.of(context).colorScheme;
return Wrap(
spacing: 6,
runSpacing: 6,
direction: Axis.horizontal,
textDirection: TextDirection.ltr,
children: videoTags!.map((tag) {
return InkWell(
onTap: () {
Get.toNamed('/searchResult', parameters: {'keyword': tag});
},
borderRadius: BorderRadius.circular(6),
child: Container(
decoration: BoxDecoration(
color: colorScheme.surfaceVariant.withOpacity(0.5),
borderRadius: BorderRadius.circular(6),
),
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 10),
child: Text(
tag,
style: TextStyle(
fontSize: 12,
color: colorScheme.onSurfaceVariant,
),
),
),
);
}).toList(),
);
}
}