基础页面

This commit is contained in:
2022-10-20 14:21:39 +08:00
parent 49ad269c2b
commit 42ba10ec61
62 changed files with 5132 additions and 54 deletions

30
lib/utils/convert.dart Normal file
View File

@@ -0,0 +1,30 @@
import 'package:dart_date/dart_date.dart';
class Convert {
/// 隐藏字符串中间位
///
/// * [str] 要处理的字符串
/// * [start] 字符串从0开始保留位数
/// * [end] 末尾保留的长度
static String hideCenterStr(
String str, {
int start = 8,
int end = 6,
}) {
if (str.length <= start + end) {
return str;
}
return '${str.substring(0, start)}...${str.substring(str.length - end)}';
}
/// 时间戳转日期
///
/// [timestamp] 要转换的时间戳
/// [format] 日期格式
static String timeFormat(
int timestamp, {
String format = 'yyyy-MM-dd HH:mm:ss',
}) {
return DateTime.fromMillisecondsSinceEpoch(timestamp * 1000).format(format);
}
}