fix: 搜索结果类型为课堂时渲染异常
This commit is contained in:
@ -38,6 +38,10 @@ class VideoCardH extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final int aid = videoItem.aid;
|
final int aid = videoItem.aid;
|
||||||
final String bvid = videoItem.bvid;
|
final String bvid = videoItem.bvid;
|
||||||
|
String type = 'video';
|
||||||
|
try {
|
||||||
|
type = videoItem.type;
|
||||||
|
} catch (_) {}
|
||||||
final String heroTag = Utils.makeHeroTag(aid);
|
final String heroTag = Utils.makeHeroTag(aid);
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onLongPress: () {
|
onLongPress: () {
|
||||||
@ -53,6 +57,10 @@ class VideoCardH extends StatelessWidget {
|
|||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
try {
|
try {
|
||||||
|
if (type == 'ketang') {
|
||||||
|
SmartDialog.showToast('课堂视频暂不支持播放');
|
||||||
|
return;
|
||||||
|
}
|
||||||
final int cid =
|
final int cid =
|
||||||
videoItem.cid ?? await SearchHttp.ab2c(aid: aid, bvid: bvid);
|
videoItem.cid ?? await SearchHttp.ab2c(aid: aid, bvid: bvid);
|
||||||
Get.toNamed('/video?bvid=$bvid&cid=$cid',
|
Get.toNamed('/video?bvid=$bvid&cid=$cid',
|
||||||
@ -95,12 +103,20 @@ class VideoCardH extends StatelessWidget {
|
|||||||
height: maxHeight,
|
height: maxHeight,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
PBadge(
|
if (videoItem.duration != 0)
|
||||||
text: Utils.timeFormat(videoItem.duration!),
|
PBadge(
|
||||||
right: 6.0,
|
text: Utils.timeFormat(videoItem.duration!),
|
||||||
bottom: 6.0,
|
right: 6.0,
|
||||||
type: 'gray',
|
bottom: 6.0,
|
||||||
),
|
type: 'gray',
|
||||||
|
),
|
||||||
|
if (type != 'video')
|
||||||
|
PBadge(
|
||||||
|
text: type,
|
||||||
|
left: 6.0,
|
||||||
|
bottom: 6.0,
|
||||||
|
type: 'primary',
|
||||||
|
),
|
||||||
// if (videoItem.rcmdReason != null &&
|
// if (videoItem.rcmdReason != null &&
|
||||||
// videoItem.rcmdReason.content != '')
|
// videoItem.rcmdReason.content != '')
|
||||||
// pBadge(videoItem.rcmdReason.content, context,
|
// pBadge(videoItem.rcmdReason.content, context,
|
||||||
|
@ -85,7 +85,9 @@ class SearchVideoItemModel {
|
|||||||
// title = json['title'].replaceAll(RegExp(r'<.*?>'), '');
|
// title = json['title'].replaceAll(RegExp(r'<.*?>'), '');
|
||||||
title = Em.regTitle(json['title']);
|
title = Em.regTitle(json['title']);
|
||||||
description = json['description'];
|
description = json['description'];
|
||||||
pic = 'https:${json['pic']}';
|
pic = json['pic'] != null && json['pic'].startsWith('//')
|
||||||
|
? 'https:${json['pic']}'
|
||||||
|
: json['pic'] ?? '';
|
||||||
videoReview = json['video_review'];
|
videoReview = json['video_review'];
|
||||||
pubdate = json['pubdate'];
|
pubdate = json['pubdate'];
|
||||||
senddate = json['senddate'];
|
senddate = json['senddate'];
|
||||||
|
@ -50,6 +50,9 @@ class Utils {
|
|||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
if (time < 3600) {
|
if (time < 3600) {
|
||||||
|
if (time == 0) {
|
||||||
|
return time;
|
||||||
|
}
|
||||||
final int minute = time ~/ 60;
|
final int minute = time ~/ 60;
|
||||||
final double res = time / 60;
|
final double res = time / 60;
|
||||||
if (minute != res) {
|
if (minute != res) {
|
||||||
@ -87,6 +90,9 @@ class Utils {
|
|||||||
|
|
||||||
// 时间显示,刚刚,x分钟前
|
// 时间显示,刚刚,x分钟前
|
||||||
static String dateFormat(timeStamp, {formatType = 'list'}) {
|
static String dateFormat(timeStamp, {formatType = 'list'}) {
|
||||||
|
if (timeStamp == 0 || timeStamp == null || timeStamp == '') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
// 当前时间
|
// 当前时间
|
||||||
int time = (DateTime.now().millisecondsSinceEpoch / 1000).round();
|
int time = (DateTime.now().millisecondsSinceEpoch / 1000).round();
|
||||||
// 对比
|
// 对比
|
||||||
@ -103,6 +109,7 @@ class Utils {
|
|||||||
toInt: false,
|
toInt: false,
|
||||||
formatType: formatType);
|
formatType: formatType);
|
||||||
}
|
}
|
||||||
|
print('distance: $distance');
|
||||||
if (distance <= 60) {
|
if (distance <= 60) {
|
||||||
return '刚刚';
|
return '刚刚';
|
||||||
} else if (distance <= 3600) {
|
} else if (distance <= 3600) {
|
||||||
@ -344,9 +351,8 @@ class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static List<int> generateRandomBytes(int minLength, int maxLength) {
|
static List<int> generateRandomBytes(int minLength, int maxLength) {
|
||||||
return List<int>.generate(
|
return List<int>.generate(random.nextInt(maxLength - minLength + 1),
|
||||||
random.nextInt(maxLength-minLength+1), (_) => random.nextInt(0x60) + 0x20
|
(_) => random.nextInt(0x60) + 0x20);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static String base64EncodeRandomString(int minLength, int maxLength) {
|
static String base64EncodeRandomString(int minLength, int maxLength) {
|
||||||
|
Reference in New Issue
Block a user