mod: 首页显示播放量、弹幕数

This commit is contained in:
guozhigq
2023-09-02 17:07:18 +08:00
parent a0d71491be
commit 72b1116b57
2 changed files with 24 additions and 13 deletions

View File

@ -79,7 +79,7 @@ class VideoCardV extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
String heroTag = Utils.makeHeroTag(videoItem.id); String heroTag = Utils.makeHeroTag(videoItem.id);
return Card( return Card(
elevation: crossAxisCount == 1 ? 0 : 1, elevation: 0,
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
margin: EdgeInsets.zero, margin: EdgeInsets.zero,
child: GestureDetector( child: GestureDetector(
@ -112,7 +112,7 @@ class VideoCardV extends StatelessWidget {
height: maxHeight, height: maxHeight,
), ),
), ),
if (crossAxisCount == 1) if (crossAxisCount == 1 && videoItem.duration != null)
PBadge( PBadge(
bottom: 10, bottom: 10,
right: 10, right: 10,
@ -144,10 +144,10 @@ class VideoContent extends StatelessWidget {
child: Padding( child: Padding(
padding: crossAxisCount == 1 padding: crossAxisCount == 1
? const EdgeInsets.fromLTRB(9, 9, 9, 4) ? const EdgeInsets.fromLTRB(9, 9, 9, 4)
: const EdgeInsets.fromLTRB(9, 8, 9, 4), : const EdgeInsets.fromLTRB(5, 8, 5, 4),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween, // mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Row( Row(
children: [ children: [
@ -173,7 +173,13 @@ class VideoContent extends StatelessWidget {
], ],
], ],
), ),
if (crossAxisCount == 1) const SizedBox(height: 6), if (crossAxisCount > 1) ...[
const SizedBox(height: 3),
VideoStat(
videoItem: videoItem,
),
],
if (crossAxisCount == 1) const SizedBox(height: 4),
Row( Row(
children: [ children: [
if (videoItem.goto == 'bangumi') ...[ if (videoItem.goto == 'bangumi') ...[
@ -226,10 +232,10 @@ class VideoContent extends StatelessWidget {
), ),
VideoStat( VideoStat(
videoItem: videoItem, videoItem: videoItem,
) ),
const Spacer(),
], ],
const Spacer(), if (videoItem.goto == 'av' && crossAxisCount != 1) ...[
if (videoItem.goto == 'av' && crossAxisCount != 1)
WatchLater( WatchLater(
size: 24, size: 24,
iconSize: 14, iconSize: 14,
@ -240,6 +246,9 @@ class VideoContent extends StatelessWidget {
SmartDialog.showToast(res['msg']); SmartDialog.showToast(res['msg']);
}, },
), ),
] else ...[
const SizedBox(height: 26)
]
], ],
), ),
], ],
@ -262,16 +271,16 @@ class VideoStat extends StatelessWidget {
return Row( return Row(
children: [ children: [
Text( Text(
'${videoItem.stat.view}观看', '${videoItem.stat.view}观看',
style: TextStyle( style: TextStyle(
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize, fontSize: Theme.of(context).textTheme.labelSmall!.fontSize,
color: Theme.of(context).colorScheme.outline, color: Theme.of(context).colorScheme.outline,
), ),
), ),
Text( Text(
'${videoItem.stat.danmu}弹幕', '${videoItem.stat.danmu}弹幕',
style: TextStyle( style: TextStyle(
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize, fontSize: Theme.of(context).textTheme.labelSmall!.fontSize,
color: Theme.of(context).colorScheme.outline, color: Theme.of(context).colorScheme.outline,
), ),
), ),

View File

@ -153,7 +153,9 @@ class _RcmdPageState extends State<RcmdPage>
int crossAxisCount = ctr.crossAxisCount.value; int crossAxisCount = ctr.crossAxisCount.value;
double mainAxisExtent = double mainAxisExtent =
(Get.size.width / crossAxisCount / StyleString.aspectRatio) + (Get.size.width / crossAxisCount / StyleString.aspectRatio) +
68 * MediaQuery.of(context).textScaleFactor; (crossAxisCount == 1
? 68
: 86 * MediaQuery.of(context).textScaleFactor);
return SliverGrid( return SliverGrid(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
// 行间距 // 行间距