aves/lib/widgets/viewer/overlay/details/shooting.dart
Thibault Deckers e8893f7f07 refactor
2023-03-24 17:29:50 +01:00

43 lines
1.7 KiB
Dart

import 'package:aves/model/metadata/overlay.dart';
import 'package:aves/theme/icons.dart';
import 'package:aves/theme/styles.dart';
import 'package:aves/theme/text.dart';
import 'package:aves/widgets/common/extensions/build_context.dart';
import 'package:aves/widgets/viewer/overlay/details/details.dart';
import 'package:decorated_icon/decorated_icon.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
class OverlayShootingRow extends StatelessWidget {
final OverlayMetadata details;
const OverlayShootingRow({
super.key,
required this.details,
});
@override
Widget build(BuildContext context) {
final locale = context.l10n.localeName;
final aperture = details.aperture;
final apertureText = aperture != null ? 'ƒ/${NumberFormat('0.0', locale).format(aperture)}' : AText.valueNotAvailable;
final focalLength = details.focalLength;
final focalLengthText = focalLength != null ? context.l10n.focalLength(NumberFormat('0.#', locale).format(focalLength)) : AText.valueNotAvailable;
final iso = details.iso;
final isoText = iso != null ? 'ISO$iso' : AText.valueNotAvailable;
return Row(
children: [
DecoratedIcon(AIcons.shooting, size: ViewerDetailOverlayContent.iconSize, shadows: ViewerDetailOverlayContent.shadows(context)),
const SizedBox(width: ViewerDetailOverlayContent.iconPadding),
Expanded(child: Text(apertureText, strutStyle: AStyles.overflowStrut)),
Expanded(child: Text(details.exposureTime ?? AText.valueNotAvailable, strutStyle: AStyles.overflowStrut)),
Expanded(child: Text(focalLengthText, strutStyle: AStyles.overflowStrut)),
Expanded(child: Text(isoText, strutStyle: AStyles.overflowStrut)),
],
);
}
}