[flutter]: format time of trash cell

This commit is contained in:
annie 2021-11-16 21:38:39 +08:00
parent 796a0a9f41
commit 19968010af
2 changed files with 12 additions and 3 deletions

View File

@ -4,6 +4,8 @@ import 'package:flowy_infra_ui/style_widget/text.dart';
import 'package:flowy_infra_ui/widget/spacing.dart';
import 'package:flowy_sdk/protobuf/flowy-workspace-infra/trash_create.pb.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:fixnum/fixnum.dart' as $fixnum;
import 'sizes.dart';
@ -18,8 +20,8 @@ class TrashCell extends StatelessWidget {
return Row(
children: [
SizedBox(width: TrashSizes.fileNameWidth, child: FlowyText(object.name, fontSize: 12)),
SizedBox(width: TrashSizes.lashModifyWidth, child: FlowyText("${object.modifiedTime}", fontSize: 12)),
SizedBox(width: TrashSizes.createTimeWidth, child: FlowyText("${object.createTime}", fontSize: 12)),
SizedBox(width: TrashSizes.lashModifyWidth, child: FlowyText(dateFormatter(object.modifiedTime), fontSize: 12)),
SizedBox(width: TrashSizes.createTimeWidth, child: FlowyText(dateFormatter(object.createTime), fontSize: 12)),
const Spacer(),
FlowyIconButton(
width: 16,
@ -35,4 +37,11 @@ class TrashCell extends StatelessWidget {
],
);
}
String dateFormatter($fixnum.Int64 inputTimestamps) {
var outputFormat = DateFormat('MM/dd/yyyy hh:mm a');
var date = DateTime.fromMillisecondsSinceEpoch(inputTimestamps.toInt() * 1000);
var outputDate = outputFormat.format(date);
return outputDate;
}
}

View File

@ -55,4 +55,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c
COCOAPODS: 1.10.1
COCOAPODS: 1.11.2