个人详情用时转时分秒显示
This commit is contained in:
parent
e4c00bf8d8
commit
d7ad4912eb
|
|
@ -90,8 +90,6 @@ class _JobPersonalDetailState extends State<JobPersonalDetail> with CommonMixin,
|
|||
}
|
||||
|
||||
totalPages = res.data!.pagedList.totalPages;
|
||||
print('dataLists=${dataList.length}');
|
||||
print('totalpages=$totalPages');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import 'package:data_table_2/data_table_2.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:marking_app/common/model/job/job_data_report.dart';
|
||||
import 'package:marking_app/utils/common_utils.dart';
|
||||
import 'package:marking_app/utils/easy_refresh/MyEmptyWidget.dart';
|
||||
import 'package:photo_view/photo_view.dart';
|
||||
|
||||
|
|
@ -80,7 +81,7 @@ class _StudentZgTableState extends State<StudentZgTable> {
|
|||
DataCell(Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 5.r),
|
||||
child: Text(item.useTime.toString(),
|
||||
child: Text(CommonUtils.second2HMS(item.useTime!),
|
||||
style: TextStyle(fontSize: 12.sp, color: Color(0xFF525252))),
|
||||
),
|
||||
)),
|
||||
|
|
|
|||
|
|
@ -18,4 +18,31 @@ class CommonUtils {
|
|||
// 这里其实就是 digest.toString()
|
||||
return hex.encode(digest.bytes);
|
||||
}
|
||||
|
||||
///补零
|
||||
static String zeroFill(int i) {
|
||||
return i >= 10 ? "$i" : "0$i";
|
||||
}
|
||||
/// 秒转时分秒
|
||||
static String second2HMS(int sec, {bool isEasy = false}) {
|
||||
String hms = "00:00:00";
|
||||
if (!isEasy) hms = "00时00分00秒";
|
||||
if (sec > 0) {
|
||||
int h = sec ~/ 3600;
|
||||
int m = (sec % 3600) ~/ 60;
|
||||
int s = sec % 60;
|
||||
/* hms = "${zeroFill(h)}:${zeroFill(m)}:${zeroFill(s)}";
|
||||
if (!isEasy) hms = "${zeroFill(h)}时${zeroFill(m)}分${zeroFill(s)}秒";*/
|
||||
if(h>0){
|
||||
hms = "$h时$m分$s秒";
|
||||
}else{
|
||||
if(m>0){
|
||||
hms = "$m分$s秒";
|
||||
}else{
|
||||
hms = "$s秒";
|
||||
}
|
||||
}
|
||||
}
|
||||
return hms;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue