mirror of
https://github.com/immich-app/immich.git
synced 2024-12-25 10:43:13 +02:00
fix(mobile): Clean up image details if there is missing info (#4018)
* fix 0,0 location * image details cleanup * Static anal fix
This commit is contained in:
parent
fd78b89c92
commit
fb477627c7
@ -18,7 +18,10 @@ class ExifBottomSheet extends HookConsumerWidget {
|
||||
const ExifBottomSheet({Key? key, required this.asset}) : super(key: key);
|
||||
|
||||
bool get hasCoordinates =>
|
||||
asset.exifInfo?.latitude != null && asset.exifInfo?.longitude != null;
|
||||
asset.exifInfo?.latitude != null &&
|
||||
asset.exifInfo?.longitude != null &&
|
||||
asset.exifInfo!.latitude! != 0 &&
|
||||
asset.exifInfo!.longitude! != 0;
|
||||
|
||||
String get formattedDateTime {
|
||||
final fileCreatedAt = asset.fileCreatedAt.toLocal();
|
||||
@ -124,7 +127,7 @@ class ExifBottomSheet extends HookConsumerWidget {
|
||||
? formatBytes(a.exifInfo!.fileSize!)
|
||||
: "";
|
||||
String text = resolution + fileSize;
|
||||
return text.isEmpty ? null : Text(text);
|
||||
return text.isNotEmpty ? text : null;
|
||||
}
|
||||
|
||||
buildDragHeader() {
|
||||
@ -208,7 +211,59 @@ class ExifBottomSheet extends HookConsumerWidget {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
buildImageProperties() {
|
||||
// Helper to create the ListTile and avoid repeating code
|
||||
createImagePropertiesListStyle(title, subtitle) => ListTile(
|
||||
contentPadding: const EdgeInsets.all(0),
|
||||
dense: true,
|
||||
leading: Icon(
|
||||
Icons.image,
|
||||
color: textColor.withAlpha(200),
|
||||
),
|
||||
titleAlignment: ListTileTitleAlignment.center,
|
||||
title: Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: textColor,
|
||||
),
|
||||
),
|
||||
subtitle: subtitle,
|
||||
);
|
||||
|
||||
final imgSizeString = buildSizeText(asset);
|
||||
|
||||
if (imgSizeString == null && asset.fileName.isNotEmpty) {
|
||||
// There is only filename
|
||||
return createImagePropertiesListStyle(
|
||||
asset.fileName,
|
||||
null,
|
||||
);
|
||||
} else if (imgSizeString != null && asset.fileName.isNotEmpty) {
|
||||
// There is both filename and size information
|
||||
return createImagePropertiesListStyle(
|
||||
asset.fileName,
|
||||
Text(imgSizeString),
|
||||
);
|
||||
} else if (imgSizeString != null && asset.fileName.isEmpty) {
|
||||
// There is only size information
|
||||
return createImagePropertiesListStyle(
|
||||
imgSizeString,
|
||||
null,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
buildDetail() {
|
||||
final imgProperties = buildImageProperties();
|
||||
|
||||
// There are no details
|
||||
if (imgProperties == null &&
|
||||
(exifInfo == null || exifInfo.make == null)) {
|
||||
return Container();
|
||||
}
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@ -223,22 +278,7 @@ class ExifBottomSheet extends HookConsumerWidget {
|
||||
),
|
||||
).tr(),
|
||||
),
|
||||
ListTile(
|
||||
contentPadding: const EdgeInsets.all(0),
|
||||
dense: true,
|
||||
leading: Icon(
|
||||
Icons.image,
|
||||
color: textColor.withAlpha(200),
|
||||
),
|
||||
title: Text(
|
||||
asset.fileName,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: textColor,
|
||||
),
|
||||
),
|
||||
subtitle: buildSizeText(asset),
|
||||
),
|
||||
if (imgProperties != null) imgProperties,
|
||||
if (exifInfo?.make != null)
|
||||
ListTile(
|
||||
contentPadding: const EdgeInsets.all(0),
|
||||
|
Loading…
Reference in New Issue
Block a user