mirror of
https://github.com/immich-app/immich.git
synced 2025-12-05 20:40:29 -08:00
fix: exposure info and better readability (#24344)
fix: exposure info and better readabilit
This commit is contained in:
@@ -37,7 +37,7 @@ class ExifInfo {
|
|||||||
|
|
||||||
String get fNumber => f == null ? "" : f!.toStringAsFixed(1);
|
String get fNumber => f == null ? "" : f!.toStringAsFixed(1);
|
||||||
|
|
||||||
String get focalLength => mm == null ? "" : mm!.toStringAsFixed(1);
|
String get focalLength => mm == null ? "" : mm!.toStringAsFixed(3);
|
||||||
|
|
||||||
const ExifInfo({
|
const ExifInfo({
|
||||||
this.assetId,
|
this.assetId,
|
||||||
|
|||||||
@@ -166,5 +166,6 @@ extension RemoteExifEntityDataDomainEx on RemoteExifEntityData {
|
|||||||
mm: focalLength?.toDouble(),
|
mm: focalLength?.toDouble(),
|
||||||
lens: lens,
|
lens: lens,
|
||||||
isFlipped: ExifDtoConverter.isOrientationFlipped(orientation),
|
isFlipped: ExifDtoConverter.isOrientationFlipped(orientation),
|
||||||
|
exposureSeconds: ExifDtoConverter.exposureTimeToSeconds(exposureTime),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ abstract final class ExifDtoConverter {
|
|||||||
f: dto.fNumber?.toDouble(),
|
f: dto.fNumber?.toDouble(),
|
||||||
mm: dto.focalLength?.toDouble(),
|
mm: dto.focalLength?.toDouble(),
|
||||||
iso: dto.iso?.toInt(),
|
iso: dto.iso?.toInt(),
|
||||||
exposureSeconds: _exposureTimeToSeconds(dto.exposureTime),
|
exposureSeconds: exposureTimeToSeconds(dto.exposureTime),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,15 +36,15 @@ abstract final class ExifDtoConverter {
|
|||||||
return isRotated90CW || isRotated270CW;
|
return isRotated90CW || isRotated270CW;
|
||||||
}
|
}
|
||||||
|
|
||||||
static double? _exposureTimeToSeconds(String? s) {
|
static double? exposureTimeToSeconds(String? second) {
|
||||||
if (s == null) {
|
if (second == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
double? value = double.tryParse(s);
|
double? value = double.tryParse(second);
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
final parts = s.split("/");
|
final parts = second.split("/");
|
||||||
if (parts.length == 2) {
|
if (parts.length == 2) {
|
||||||
final numerator = double.tryParse(parts.firstOrNull ?? "-");
|
final numerator = double.tryParse(parts.firstOrNull ?? "-");
|
||||||
final denominator = double.tryParse(parts.lastOrNull ?? "-");
|
final denominator = double.tryParse(parts.lastOrNull ?? "-");
|
||||||
|
|||||||
@@ -251,8 +251,8 @@ class _AssetDetailBottomSheet extends ConsumerWidget {
|
|||||||
color: context.textTheme.labelLarge?.color,
|
color: context.textTheme.labelLarge?.color,
|
||||||
),
|
),
|
||||||
subtitle: _getFileInfo(asset, exifInfo),
|
subtitle: _getFileInfo(asset, exifInfo),
|
||||||
subtitleStyle: context.textTheme.bodyMedium?.copyWith(
|
subtitleStyle: context.textTheme.labelMedium?.copyWith(
|
||||||
color: context.textTheme.bodyMedium?.color?.withAlpha(155),
|
color: context.textTheme.labelMedium?.color?.withAlpha(200),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -268,8 +268,8 @@ class _AssetDetailBottomSheet extends ConsumerWidget {
|
|||||||
color: context.textTheme.labelLarge?.color,
|
color: context.textTheme.labelLarge?.color,
|
||||||
),
|
),
|
||||||
subtitle: _getFileInfo(asset, exifInfo),
|
subtitle: _getFileInfo(asset, exifInfo),
|
||||||
subtitleStyle: context.textTheme.bodyMedium?.copyWith(
|
subtitleStyle: context.textTheme.labelMedium?.copyWith(
|
||||||
color: context.textTheme.bodyMedium?.color?.withAlpha(155),
|
color: context.textTheme.labelMedium?.color?.withAlpha(200),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -280,7 +280,7 @@ class _AssetDetailBottomSheet extends ConsumerWidget {
|
|||||||
// Asset Date and Time
|
// Asset Date and Time
|
||||||
SheetTile(
|
SheetTile(
|
||||||
title: _getDateTime(context, asset, exifInfo),
|
title: _getDateTime(context, asset, exifInfo),
|
||||||
titleStyle: context.textTheme.bodyMedium?.copyWith(fontWeight: FontWeight.w600),
|
titleStyle: context.textTheme.labelLarge,
|
||||||
trailing: asset.hasRemote && isOwner ? const Icon(Icons.edit, size: 18) : null,
|
trailing: asset.hasRemote && isOwner ? const Icon(Icons.edit, size: 18) : null,
|
||||||
onTap: asset.hasRemote && isOwner ? () async => await _editDateTime(context, ref) : null,
|
onTap: asset.hasRemote && isOwner ? () async => await _editDateTime(context, ref) : null,
|
||||||
),
|
),
|
||||||
@@ -289,7 +289,7 @@ class _AssetDetailBottomSheet extends ConsumerWidget {
|
|||||||
const SheetLocationDetails(),
|
const SheetLocationDetails(),
|
||||||
// Details header
|
// Details header
|
||||||
SheetTile(
|
SheetTile(
|
||||||
title: 'exif_bottom_sheet_details'.t(context: context),
|
title: 'details'.t(context: context).toUpperCase(),
|
||||||
titleStyle: context.textTheme.labelMedium?.copyWith(
|
titleStyle: context.textTheme.labelMedium?.copyWith(
|
||||||
color: context.textTheme.labelMedium?.color?.withAlpha(200),
|
color: context.textTheme.labelMedium?.color?.withAlpha(200),
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
@@ -298,29 +298,33 @@ class _AssetDetailBottomSheet extends ConsumerWidget {
|
|||||||
// File info
|
// File info
|
||||||
buildFileInfoTile(),
|
buildFileInfoTile(),
|
||||||
// Camera info
|
// Camera info
|
||||||
if (cameraTitle != null)
|
if (cameraTitle != null) ...[
|
||||||
|
const SizedBox(height: 16),
|
||||||
SheetTile(
|
SheetTile(
|
||||||
title: cameraTitle,
|
title: cameraTitle,
|
||||||
titleStyle: context.textTheme.labelLarge,
|
titleStyle: context.textTheme.labelLarge,
|
||||||
leading: Icon(Icons.camera_alt_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.labelMedium?.copyWith(
|
||||||
color: context.textTheme.bodyMedium?.color?.withAlpha(155),
|
color: context.textTheme.labelMedium?.color?.withAlpha(200),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
// Lens info
|
// Lens info
|
||||||
if (lensTitle != null)
|
if (lensTitle != null) ...[
|
||||||
|
const SizedBox(height: 16),
|
||||||
SheetTile(
|
SheetTile(
|
||||||
title: lensTitle,
|
title: lensTitle,
|
||||||
titleStyle: context.textTheme.labelLarge,
|
titleStyle: context.textTheme.labelLarge,
|
||||||
leading: Icon(Icons.camera_outlined, size: 24, color: context.textTheme.labelLarge?.color),
|
leading: Icon(Icons.camera_outlined, size: 24, color: context.textTheme.labelLarge?.color),
|
||||||
subtitle: _getLensInfoSubtitle(exifInfo),
|
subtitle: _getLensInfoSubtitle(exifInfo),
|
||||||
subtitleStyle: context.textTheme.bodyMedium?.copyWith(
|
subtitleStyle: context.textTheme.labelMedium?.copyWith(
|
||||||
color: context.textTheme.bodyMedium?.color?.withAlpha(155),
|
color: context.textTheme.labelMedium?.color?.withAlpha(200),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
// Appears in (Albums)
|
// Appears in (Albums)
|
||||||
_buildAppearsInList(ref, context),
|
Padding(padding: const EdgeInsets.only(top: 16.0), child: _buildAppearsInList(ref, context)),
|
||||||
// padding at the bottom to avoid cut-off
|
// padding at the bottom to avoid cut-off
|
||||||
const SizedBox(height: 100),
|
const SizedBox(height: 100),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class _SheetLocationDetailsState extends ConsumerState<SheetLocationDetails> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
SheetTile(
|
SheetTile(
|
||||||
title: 'exif_bottom_sheet_location'.t(context: context),
|
title: 'location'.t(context: context).toUpperCase(),
|
||||||
titleStyle: context.textTheme.labelMedium?.copyWith(
|
titleStyle: context.textTheme.labelMedium?.copyWith(
|
||||||
color: context.textTheme.labelMedium?.color?.withAlpha(200),
|
color: context.textTheme.labelMedium?.color?.withAlpha(200),
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
@@ -102,7 +102,7 @@ class _SheetLocationDetailsState extends ConsumerState<SheetLocationDetails> {
|
|||||||
Text(
|
Text(
|
||||||
coordinates,
|
coordinates,
|
||||||
style: context.textTheme.labelMedium?.copyWith(
|
style: context.textTheme.labelMedium?.copyWith(
|
||||||
color: context.textTheme.labelMedium?.color?.withAlpha(150),
|
color: context.textTheme.labelMedium?.color?.withAlpha(200),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class SheetTile extends ConsumerWidget {
|
|||||||
} else {
|
} else {
|
||||||
titleWidget = Container(
|
titleWidget = Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
padding: const EdgeInsets.only(left: 15),
|
padding: const EdgeInsets.only(left: 15, right: 15),
|
||||||
child: Text(title, style: titleStyle),
|
child: Text(title, style: titleStyle),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user