Display file size in MBs
This commit is contained in:
parent
38f9bb6174
commit
a13c7c269c
1 changed files with 17 additions and 5 deletions
|
@ -237,9 +237,11 @@ class _DetailPageState extends State<DetailPage> {
|
||||||
|
|
||||||
Future<void> _displayInfo(File file) async {
|
Future<void> _displayInfo(File file) async {
|
||||||
AssetEntity asset;
|
AssetEntity asset;
|
||||||
|
int fileSize;
|
||||||
final isLocalFile = file.localID != null;
|
final isLocalFile = file.localID != null;
|
||||||
if (isLocalFile) {
|
if (isLocalFile) {
|
||||||
asset = await file.getAsset();
|
asset = await file.getAsset();
|
||||||
|
fileSize = await (await asset.file).length();
|
||||||
}
|
}
|
||||||
return showDialog<void>(
|
return showDialog<void>(
|
||||||
context: context,
|
context: context,
|
||||||
|
@ -247,7 +249,7 @@ class _DetailPageState extends State<DetailPage> {
|
||||||
var items = <Widget>[
|
var items = <Widget>[
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(Icons.timer),
|
Icon(Icons.calendar_today_outlined),
|
||||||
Padding(padding: EdgeInsets.all(4)),
|
Padding(padding: EdgeInsets.all(4)),
|
||||||
Text(getFormattedTime(
|
Text(getFormattedTime(
|
||||||
DateTime.fromMicrosecondsSinceEpoch(file.creationTime))),
|
DateTime.fromMicrosecondsSinceEpoch(file.creationTime))),
|
||||||
|
@ -256,7 +258,7 @@ class _DetailPageState extends State<DetailPage> {
|
||||||
Padding(padding: EdgeInsets.all(4)),
|
Padding(padding: EdgeInsets.all(4)),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(Icons.folder),
|
Icon(Icons.folder_outlined),
|
||||||
Padding(padding: EdgeInsets.all(4)),
|
Padding(padding: EdgeInsets.all(4)),
|
||||||
Text(file.deviceFolder),
|
Text(file.deviceFolder),
|
||||||
],
|
],
|
||||||
|
@ -264,10 +266,20 @@ class _DetailPageState extends State<DetailPage> {
|
||||||
Padding(padding: EdgeInsets.all(4)),
|
Padding(padding: EdgeInsets.all(4)),
|
||||||
];
|
];
|
||||||
if (isLocalFile) {
|
if (isLocalFile) {
|
||||||
|
items.add(Row(
|
||||||
|
children: [
|
||||||
|
Icon(Icons.sd_storage_outlined),
|
||||||
|
Padding(padding: EdgeInsets.all(4)),
|
||||||
|
Text((fileSize / (1024 * 1024)).toStringAsFixed(2) + " MB"),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
items.add(
|
||||||
|
Padding(padding: EdgeInsets.all(4)),
|
||||||
|
);
|
||||||
if (file.fileType == FileType.image) {
|
if (file.fileType == FileType.image) {
|
||||||
items.add(Row(
|
items.add(Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(Icons.photo_size_select_actual),
|
Icon(Icons.photo_size_select_actual_outlined),
|
||||||
Padding(padding: EdgeInsets.all(4)),
|
Padding(padding: EdgeInsets.all(4)),
|
||||||
Text(asset.width.toString() + " x " + asset.height.toString()),
|
Text(asset.width.toString() + " x " + asset.height.toString()),
|
||||||
],
|
],
|
||||||
|
@ -275,7 +287,7 @@ class _DetailPageState extends State<DetailPage> {
|
||||||
} else {
|
} else {
|
||||||
items.add(Row(
|
items.add(Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(Icons.timer),
|
Icon(Icons.timer_outlined),
|
||||||
Padding(padding: EdgeInsets.all(4)),
|
Padding(padding: EdgeInsets.all(4)),
|
||||||
Text(asset.videoDuration.toString().split(".")[0]),
|
Text(asset.videoDuration.toString().split(".")[0]),
|
||||||
],
|
],
|
||||||
|
@ -288,7 +300,7 @@ class _DetailPageState extends State<DetailPage> {
|
||||||
);
|
);
|
||||||
items.add(Row(
|
items.add(Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(Icons.cloud_upload),
|
Icon(Icons.cloud_upload_outlined),
|
||||||
Padding(padding: EdgeInsets.all(4)),
|
Padding(padding: EdgeInsets.all(4)),
|
||||||
Text(getFormattedTime(
|
Text(getFormattedTime(
|
||||||
DateTime.fromMicrosecondsSinceEpoch(file.updationTime))),
|
DateTime.fromMicrosecondsSinceEpoch(file.updationTime))),
|
||||||
|
|
Loading…
Add table
Reference in a new issue