fix: 搜索结果类型为课堂时渲染异常

This commit is contained in:
guozhigq
2024-03-09 01:18:26 +08:00
committed by orz12
parent a093ab7eec
commit 538b7031a5
3 changed files with 32 additions and 8 deletions

View File

@@ -130,6 +130,9 @@ class Utils {
return time;
}
if (time < 3600) {
if (time == 0) {
return time;
}
final int minute = time ~/ 60;
final double res = time / 60;
if (minute != res) {
@@ -167,6 +170,9 @@ class Utils {
// 时间显示刚刚x分钟前
static String dateFormat(timeStamp, {formatType = 'list'}) {
if (timeStamp == 0 || timeStamp == null || timeStamp == '') {
return '';
}
// 当前时间
int time = (DateTime.now().millisecondsSinceEpoch / 1000).round();
// 对比
@@ -193,6 +199,7 @@ class Utils {
toInt: true,
);
}
print('distance: $distance');
if (distance <= 60) {
return '刚刚';
} else if (distance <= 3600) {