aves/lib/widgets/fullscreen/info/basic_section.dart
2019-09-07 00:31:49 +09:00

40 lines
1.3 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'package:aves/model/image_entry.dart';
import 'package:aves/utils/file_utils.dart';
import 'package:aves/widgets/fullscreen/info/info_page.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
class BasicSection extends StatelessWidget {
final ImageEntry entry;
const BasicSection({
Key key,
@required this.entry,
}) : super(key: key);
@override
Widget build(BuildContext context) {
final date = entry.bestDate;
final dateText = '${DateFormat.yMMMd().format(date)} ${DateFormat.Hm().format(date)}';
final resolutionText = '${entry.width} × ${entry.height}${entry.isVideo ? '' : ' (${entry.megaPixels} MP)'}';
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
InfoRow('Title', entry.title),
InfoRow('Date', dateText),
if (entry.isVideo) ..._buildVideoRows(),
InfoRow('Resolution', resolutionText),
InfoRow('Size', formatFilesize(entry.sizeBytes)),
InfoRow('Uri', entry.uri),
InfoRow('Path', entry.path),
],
);
}
List<Widget> _buildVideoRows() {
final rotation = entry.catalogMetadata?.videoRotation;
if (rotation != null) InfoRow('Rotation', '$rotation°');
return [InfoRow('Duration', entry.durationText), if (rotation != null) InfoRow('Rotation', '$rotation°')];
}
}