feat(mobile): Show lens model information in the asset viewer detail panel (#23601)
* feat(mobile): add lens info to details bottom sheet * fix unrelated typo * order same like in web app: first exposure time, than isopull/23660/head^2
parent
6913697ad1
commit
93ab42fa24
|
|
@ -127,13 +127,18 @@ class _AssetDetailBottomSheet extends ConsumerWidget {
|
||||||
if (exifInfo == null) {
|
if (exifInfo == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
final fNumber = exifInfo.fNumber.isNotEmpty ? 'ƒ/${exifInfo.fNumber}' : null;
|
|
||||||
final exposureTime = exifInfo.exposureTime.isNotEmpty ? exifInfo.exposureTime : null;
|
final exposureTime = exifInfo.exposureTime.isNotEmpty ? exifInfo.exposureTime : null;
|
||||||
final focalLength = exifInfo.focalLength.isNotEmpty ? '${exifInfo.focalLength} mm' : null;
|
|
||||||
final iso = exifInfo.iso != null ? 'ISO ${exifInfo.iso}' : null;
|
final iso = exifInfo.iso != null ? 'ISO ${exifInfo.iso}' : null;
|
||||||
|
return [exposureTime, iso].where((spec) => spec != null && spec.isNotEmpty).join(_kSeparator);
|
||||||
|
}
|
||||||
|
|
||||||
return [fNumber, exposureTime, focalLength, iso].where((spec) => spec != null && spec.isNotEmpty).join(_kSeparator);
|
String? _getLensInfoSubtitle(ExifInfo? exifInfo) {
|
||||||
|
if (exifInfo == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
final fNumber = exifInfo.fNumber.isNotEmpty ? 'ƒ/${exifInfo.fNumber}' : null;
|
||||||
|
final focalLength = exifInfo.focalLength.isNotEmpty ? '${exifInfo.focalLength} mm' : null;
|
||||||
|
return [fNumber, focalLength].where((spec) => spec != null && spec.isNotEmpty).join(_kSeparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _editDateTime(BuildContext context, WidgetRef ref) async {
|
Future<void> _editDateTime(BuildContext context, WidgetRef ref) async {
|
||||||
|
|
@ -141,20 +146,20 @@ class _AssetDetailBottomSheet extends ConsumerWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildAppearsInList(WidgetRef ref, BuildContext context) {
|
Widget _buildAppearsInList(WidgetRef ref, BuildContext context) {
|
||||||
final aseet = ref.watch(currentAssetNotifier);
|
final asset = ref.watch(currentAssetNotifier);
|
||||||
if (aseet == null) {
|
if (asset == null) {
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!aseet.hasRemote) {
|
if (!asset.hasRemote) {
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
}
|
}
|
||||||
|
|
||||||
String? remoteAssetId;
|
String? remoteAssetId;
|
||||||
if (aseet is RemoteAsset) {
|
if (asset is RemoteAsset) {
|
||||||
remoteAssetId = aseet.id;
|
remoteAssetId = asset.id;
|
||||||
} else if (aseet is LocalAsset) {
|
} else if (asset is LocalAsset) {
|
||||||
remoteAssetId = aseet.remoteAssetId;
|
remoteAssetId = asset.remoteAssetId;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (remoteAssetId == null) {
|
if (remoteAssetId == null) {
|
||||||
|
|
@ -217,6 +222,7 @@ class _AssetDetailBottomSheet extends ConsumerWidget {
|
||||||
|
|
||||||
final exifInfo = ref.watch(currentAssetExifProvider).valueOrNull;
|
final exifInfo = ref.watch(currentAssetExifProvider).valueOrNull;
|
||||||
final cameraTitle = _getCameraInfoTitle(exifInfo);
|
final cameraTitle = _getCameraInfoTitle(exifInfo);
|
||||||
|
final lensTitle = exifInfo?.lens != null && exifInfo!.lens!.isNotEmpty ? exifInfo.lens : null;
|
||||||
final isOwner = ref.watch(currentUserProvider)?.id == (asset is RemoteAsset ? asset.ownerId : null);
|
final isOwner = ref.watch(currentUserProvider)?.id == (asset is RemoteAsset ? asset.ownerId : null);
|
||||||
|
|
||||||
// Build file info tile based on asset type
|
// Build file info tile based on asset type
|
||||||
|
|
@ -287,12 +293,23 @@ class _AssetDetailBottomSheet extends ConsumerWidget {
|
||||||
_SheetTile(
|
_SheetTile(
|
||||||
title: cameraTitle,
|
title: cameraTitle,
|
||||||
titleStyle: context.textTheme.labelLarge,
|
titleStyle: context.textTheme.labelLarge,
|
||||||
leading: Icon(Icons.camera_outlined, size: 24, color: context.textTheme.labelLarge?.color),
|
leading: Icon(Icons.camera_alt_outlined, size: 24, color: context.textTheme.labelLarge?.color),
|
||||||
subtitle: _getCameraInfoSubtitle(exifInfo),
|
subtitle: _getCameraInfoSubtitle(exifInfo),
|
||||||
subtitleStyle: context.textTheme.bodyMedium?.copyWith(
|
subtitleStyle: context.textTheme.bodyMedium?.copyWith(
|
||||||
color: context.textTheme.bodyMedium?.color?.withAlpha(155),
|
color: context.textTheme.bodyMedium?.color?.withAlpha(155),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
// Lens info
|
||||||
|
if (lensTitle != null)
|
||||||
|
_SheetTile(
|
||||||
|
title: lensTitle,
|
||||||
|
titleStyle: context.textTheme.labelLarge,
|
||||||
|
leading: Icon(Icons.camera_outlined, size: 24, color: context.textTheme.labelLarge?.color),
|
||||||
|
subtitle: _getLensInfoSubtitle(exifInfo),
|
||||||
|
subtitleStyle: context.textTheme.bodyMedium?.copyWith(
|
||||||
|
color: context.textTheme.bodyMedium?.color?.withAlpha(155),
|
||||||
|
),
|
||||||
|
),
|
||||||
// Appears in (Albums)
|
// Appears in (Albums)
|
||||||
_buildAppearsInList(ref, context),
|
_buildAppearsInList(ref, context),
|
||||||
// padding at the bottom to avoid cut-off
|
// padding at the bottom to avoid cut-off
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue