mirror of
https://github.com/immich-app/immich.git
synced 2024-12-29 15:11:58 +00: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
1 changed files with 58 additions and 18 deletions
|
@ -18,7 +18,10 @@ class ExifBottomSheet extends HookConsumerWidget {
|
||||||
const ExifBottomSheet({Key? key, required this.asset}) : super(key: key);
|
const ExifBottomSheet({Key? key, required this.asset}) : super(key: key);
|
||||||
|
|
||||||
bool get hasCoordinates =>
|
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 {
|
String get formattedDateTime {
|
||||||
final fileCreatedAt = asset.fileCreatedAt.toLocal();
|
final fileCreatedAt = asset.fileCreatedAt.toLocal();
|
||||||
|
@ -124,7 +127,7 @@ class ExifBottomSheet extends HookConsumerWidget {
|
||||||
? formatBytes(a.exifInfo!.fileSize!)
|
? formatBytes(a.exifInfo!.fileSize!)
|
||||||
: "";
|
: "";
|
||||||
String text = resolution + fileSize;
|
String text = resolution + fileSize;
|
||||||
return text.isEmpty ? null : Text(text);
|
return text.isNotEmpty ? text : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
buildDragHeader() {
|
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() {
|
buildDetail() {
|
||||||
|
final imgProperties = buildImageProperties();
|
||||||
|
|
||||||
|
// There are no details
|
||||||
|
if (imgProperties == null &&
|
||||||
|
(exifInfo == null || exifInfo.make == null)) {
|
||||||
|
return Container();
|
||||||
|
}
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
@ -223,22 +278,7 @@ class ExifBottomSheet extends HookConsumerWidget {
|
||||||
),
|
),
|
||||||
).tr(),
|
).tr(),
|
||||||
),
|
),
|
||||||
ListTile(
|
if (imgProperties != null) imgProperties,
|
||||||
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 (exifInfo?.make != null)
|
if (exifInfo?.make != null)
|
||||||
ListTile(
|
ListTile(
|
||||||
contentPadding: const EdgeInsets.all(0),
|
contentPadding: const EdgeInsets.all(0),
|
||||||
|
|
Loading…
Reference in a new issue