opt video card

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-06-26 17:27:01 +08:00
parent 12c13cd25a
commit 20893ef65f
6 changed files with 19 additions and 35 deletions

View File

@@ -24,20 +24,12 @@ class VideoCardH extends StatelessWidget {
const VideoCardH({ const VideoCardH({
super.key, super.key,
required this.videoItem, required this.videoItem,
this.showOwner = true,
this.showView = true,
this.showDanmaku = true,
this.showPubdate = false,
this.onTap, this.onTap,
this.onLongPress, this.onLongPress,
this.onViewLater, this.onViewLater,
this.onRemove, this.onRemove,
}); });
final BaseVideoItemModel videoItem; final BaseVideoItemModel videoItem;
final bool showOwner;
final bool showView;
final bool showDanmaku;
final bool showPubdate;
final VoidCallback? onTap; final VoidCallback? onTap;
final VoidCallback? onLongPress; final VoidCallback? onLongPress;
final ValueChanged<int>? onViewLater; final ValueChanged<int>? onViewLater;
@@ -199,7 +191,7 @@ class VideoCardH extends StatelessWidget {
Widget content(BuildContext context) { Widget content(BuildContext context) {
final theme = Theme.of(context); final theme = Theme.of(context);
String pubdate = showPubdate ? DateUtil.dateFormat(videoItem.pubdate!) : ''; String pubdate = DateUtil.dateFormat(videoItem.pubdate!);
if (pubdate != '') pubdate += ' '; if (pubdate != '') pubdate += ' ';
return Expanded( return Expanded(
child: Column( child: Column(
@@ -242,9 +234,8 @@ class VideoCardH extends StatelessWidget {
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
), ),
if (showOwner || showPubdate)
Text( Text(
"$pubdate ${showOwner ? videoItem.owner.name : ''}", "$pubdate${videoItem.owner.name}",
maxLines: 1, maxLines: 1,
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
@@ -257,12 +248,10 @@ class VideoCardH extends StatelessWidget {
Row( Row(
spacing: 8, spacing: 8,
children: [ children: [
if (showView)
StatWidget( StatWidget(
type: StatType.play, type: StatType.play,
value: videoItem.stat.view, value: videoItem.stat.view,
), ),
if (showDanmaku)
StatWidget( StatWidget(
type: StatType.danmaku, type: StatType.danmaku,
value: videoItem.stat.danmu, value: videoItem.stat.danmu,

View File

@@ -168,7 +168,6 @@ class _HotPageState extends CommonPageState<HotPage, HotController>
} }
return VideoCardH( return VideoCardH(
videoItem: response[index], videoItem: response[index],
showPubdate: true,
onRemove: () => controller.loadingState onRemove: () => controller.loadingState
..value.data!.removeAt(index) ..value.data!.removeAt(index)
..refresh(), ..refresh(),

View File

@@ -78,7 +78,6 @@ class _ZonePageState extends CommonPageState<ZonePage, ZoneController>
if (item is HotVideoItemModel) { if (item is HotVideoItemModel) {
return VideoCardH( return VideoCardH(
videoItem: item, videoItem: item,
showPubdate: true,
onRemove: () => controller.loadingState onRemove: () => controller.loadingState
..value.data!.removeAt(index) ..value.data!.removeAt(index)
..refresh(), ..refresh(),

View File

@@ -55,7 +55,6 @@ class _SearchAllPanelState
height: 120, height: 120,
child: VideoCardH( child: VideoCardH(
videoItem: item, videoItem: item,
showPubdate: true,
), ),
), ),
List<SearchPgcItemModel>() => item.length == 1 List<SearchPgcItemModel>() => item.length == 1

View File

@@ -112,7 +112,6 @@ class _SearchVideoPanelState extends CommonSearchPanelState<SearchVideoPanel,
} }
return VideoCardH( return VideoCardH(
videoItem: list[index], videoItem: list[index],
showPubdate: true,
onRemove: () => controller.loadingState onRemove: () => controller.loadingState
..value.data!.removeAt(index) ..value.data!.removeAt(index)
..refresh(), ..refresh(),

View File

@@ -52,7 +52,6 @@ class _RelatedVideoPanelState extends State<RelatedVideoPanel>
(context, index) { (context, index) {
return VideoCardH( return VideoCardH(
videoItem: response[index], videoItem: response[index],
showPubdate: true,
onRemove: () => _relatedController.loadingState onRemove: () => _relatedController.loadingState
..value.data!.removeAt(index) ..value.data!.removeAt(index)
..refresh(), ..refresh(),