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 = date != null ? '${DateFormat.yMMMd().format(date)} at ${DateFormat.Hm().format(date)}' : '?'; final showMegaPixels = !entry.isVideo && !entry.isGif && entry.megaPixels != null && entry.megaPixels > 0; final resolutionText = '${entry.width ?? '?'} × ${entry.height ?? '?'}${showMegaPixels ? ' (${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', entry.sizeBytes != null ? formatFilesize(entry.sizeBytes) : '?'), InfoRow('URI', entry.uri ?? '?'), if (entry.path != null) InfoRow('Path', entry.path), ], ); } List _buildVideoRows() { final rotation = entry.catalogMetadata?.videoRotation; return [ InfoRow('Duration', entry.durationText), if (rotation != null) InfoRow('Rotation', '$rotation°'), ]; } }