add detail page

This commit is contained in:
jyuesong
2022-01-13 14:10:29 +08:00
parent 6acf427fb6
commit 80670821cd
17 changed files with 502 additions and 42 deletions

View File

@@ -1,7 +1,28 @@
import 'package:flutter/cupertino.dart';
import 'package:intl/intl.dart';
class Utils {
static void hideKeyBoard(BuildContext context) {
FocusScope.of(context).requestFocus(FocusNode());
}
static String formatMessageTime(int time) {
DateTime current = DateTime.now();
DateTime chatTime = DateTime.fromMillisecondsSinceEpoch(time * 1000);
if (current.year == chatTime.year) {
if (current.day == chatTime.day) {
if (chatTime.hour <= 12) {
return DateFormat("上午 H:mm").format(chatTime);
} else {
return DateFormat("下午 H:mm").format(chatTime);
}
} else if (chatTime.day == current.day - 1) {
return DateFormat("昨天 H:mm").format(chatTime);
} else {
return DateFormat("M/d H:mm").format(chatTime);
}
} else {
return DateFormat("yyyy/M/d HH:mm").format(chatTime);
}
}
}