mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-21 01:26:59 +08:00
feat: match info
opt dateformat Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -11,6 +11,8 @@ import 'package:PiliPlus/models/common/stat_type.dart';
|
||||
import 'package:PiliPlus/models/model_hot_video_item.dart';
|
||||
import 'package:PiliPlus/models/model_video.dart';
|
||||
import 'package:PiliPlus/models/search/result.dart';
|
||||
import 'package:PiliPlus/utils/date_util.dart';
|
||||
import 'package:PiliPlus/utils/duration_util.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -138,7 +140,7 @@ class VideoCardH extends StatelessWidget {
|
||||
PBadge(
|
||||
text: progress == -1
|
||||
? '已看完'
|
||||
: '${Utils.timeFormat(progress)}/${Utils.timeFormat(videoItem.duration)}',
|
||||
: '${DurationUtil.formatDuration(progress)}/${DurationUtil.formatDuration(videoItem.duration)}',
|
||||
right: 6,
|
||||
bottom: 8,
|
||||
type: PBadgeType.gray,
|
||||
@@ -155,7 +157,8 @@ class VideoCardH extends StatelessWidget {
|
||||
)
|
||||
] else if (videoItem.duration > 0)
|
||||
PBadge(
|
||||
text: Utils.timeFormat(videoItem.duration),
|
||||
text: DurationUtil.formatDuration(
|
||||
videoItem.duration),
|
||||
right: 6.0,
|
||||
bottom: 6.0,
|
||||
type: PBadgeType.gray,
|
||||
@@ -194,9 +197,7 @@ class VideoCardH extends StatelessWidget {
|
||||
|
||||
Widget content(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
String pubdate = showPubdate
|
||||
? Utils.dateFormat(videoItem.pubdate!, formatType: 'day')
|
||||
: '';
|
||||
String pubdate = showPubdate ? DateUtil.dateFormat(videoItem.pubdate!) : '';
|
||||
if (pubdate != '') pubdate += ' ';
|
||||
return Expanded(
|
||||
child: Column(
|
||||
|
||||
@@ -7,15 +7,17 @@ import 'package:PiliPlus/common/widgets/video_popup_menu.dart';
|
||||
import 'package:PiliPlus/http/search.dart';
|
||||
import 'package:PiliPlus/models/common/badge_type.dart';
|
||||
import 'package:PiliPlus/models/common/stat_type.dart';
|
||||
import 'package:PiliPlus/models/home/rcmd/result.dart';
|
||||
import 'package:PiliPlus/models/model_rec_video_item.dart';
|
||||
import 'package:PiliPlus/utils/app_scheme.dart';
|
||||
import 'package:PiliPlus/utils/date_util.dart';
|
||||
import 'package:PiliPlus/utils/duration_util.dart';
|
||||
import 'package:PiliPlus/utils/id_utils.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
// 视频卡片 - 垂直布局
|
||||
class VideoCardV extends StatelessWidget {
|
||||
@@ -129,7 +131,8 @@ class VideoCardV extends StatelessWidget {
|
||||
right: 7,
|
||||
size: PBadgeSize.small,
|
||||
type: PBadgeType.gray,
|
||||
text: Utils.timeFormat(videoItem.duration),
|
||||
text:
|
||||
DurationUtil.formatDuration(videoItem.duration),
|
||||
)
|
||||
],
|
||||
);
|
||||
@@ -229,6 +232,9 @@ class VideoCardV extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
static final shortFormat = DateFormat('M-d');
|
||||
static final longFormat = DateFormat('yy-M-d');
|
||||
|
||||
Widget videoStat(BuildContext context, ThemeData theme) {
|
||||
return Row(
|
||||
children: [
|
||||
@@ -248,29 +254,36 @@ class VideoCardV extends StatelessWidget {
|
||||
Text.rich(
|
||||
maxLines: 1,
|
||||
TextSpan(
|
||||
style: TextStyle(
|
||||
fontSize: theme.textTheme.labelSmall!.fontSize,
|
||||
color: theme.colorScheme.outline.withValues(alpha: 0.8),
|
||||
),
|
||||
text: Utils.formatTimestampToRelativeTime(videoItem.pubdate)),
|
||||
),
|
||||
const SizedBox(width: 2),
|
||||
] else if (videoItem is RecVideoItemAppModel &&
|
||||
videoItem.desc != null &&
|
||||
videoItem.desc!.contains(' · ')) ...[
|
||||
const Spacer(),
|
||||
Text.rich(
|
||||
maxLines: 1,
|
||||
TextSpan(
|
||||
style: TextStyle(
|
||||
fontSize: theme.textTheme.labelSmall!.fontSize,
|
||||
color: theme.colorScheme.outline.withValues(alpha: 0.8),
|
||||
),
|
||||
text: Utils.shortenChineseDateString(
|
||||
videoItem.desc!.split(' · ').last)),
|
||||
style: TextStyle(
|
||||
fontSize: theme.textTheme.labelSmall!.fontSize,
|
||||
color: theme.colorScheme.outline.withValues(alpha: 0.8),
|
||||
),
|
||||
text: DateUtil.dateFormat(
|
||||
videoItem.pubdate,
|
||||
shortFormat: shortFormat,
|
||||
longFormat: longFormat,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 2),
|
||||
]
|
||||
// deprecated
|
||||
// else if (videoItem is RecVideoItemAppModel &&
|
||||
// videoItem.desc != null &&
|
||||
// videoItem.desc!.contains(' · ')) ...[
|
||||
// const Spacer(),
|
||||
// Text.rich(
|
||||
// maxLines: 1,
|
||||
// TextSpan(
|
||||
// style: TextStyle(
|
||||
// fontSize: theme.textTheme.labelSmall!.fontSize,
|
||||
// color: theme.colorScheme.outline.withValues(alpha: 0.8),
|
||||
// ),
|
||||
// text: Utils.shortenChineseDateString(
|
||||
// videoItem.desc!.split(' · ').last)),
|
||||
// ),
|
||||
// const SizedBox(width: 2),
|
||||
// ]
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user