mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
fix: Show correct photo name in buttom sheet and backup details page (#22978)
fix: Show correct name in buttom sheet and backup details page
This commit is contained in:
parent
82a4c28606
commit
d626f86e8c
2 changed files with 95 additions and 57 deletions
|
|
@ -10,6 +10,7 @@ import 'package:immich_mobile/extensions/translate_extensions.dart';
|
||||||
import 'package:immich_mobile/pages/common/large_leading_tile.dart';
|
import 'package:immich_mobile/pages/common/large_leading_tile.dart';
|
||||||
import 'package:immich_mobile/presentation/widgets/images/thumbnail.widget.dart';
|
import 'package:immich_mobile/presentation/widgets/images/thumbnail.widget.dart';
|
||||||
import 'package:immich_mobile/providers/backup/drift_backup.provider.dart';
|
import 'package:immich_mobile/providers/backup/drift_backup.provider.dart';
|
||||||
|
import 'package:immich_mobile/repositories/asset_media.repository.dart';
|
||||||
import 'package:immich_mobile/routing/router.dart';
|
import 'package:immich_mobile/routing/router.dart';
|
||||||
|
|
||||||
@RoutePage()
|
@RoutePage()
|
||||||
|
|
@ -30,9 +31,14 @@ class DriftBackupAssetDetailPage extends ConsumerWidget {
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final asset = candidates[index];
|
final asset = candidates[index];
|
||||||
final albumsAsyncValue = ref.watch(driftCandidateBackupAlbumInfoProvider(asset.id));
|
final albumsAsyncValue = ref.watch(driftCandidateBackupAlbumInfoProvider(asset.id));
|
||||||
|
final assetMediaRepository = ref.watch(assetMediaRepositoryProvider);
|
||||||
|
return FutureBuilder<String?>(
|
||||||
|
future: assetMediaRepository.getOriginalFilename(asset.id),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
final displayName = snapshot.data ?? asset.name;
|
||||||
return LargeLeadingTile(
|
return LargeLeadingTile(
|
||||||
title: Text(
|
title: Text(
|
||||||
asset.name,
|
displayName,
|
||||||
style: context.textTheme.labelLarge?.copyWith(fontWeight: FontWeight.w500, fontSize: 16),
|
style: context.textTheme.labelLarge?.copyWith(fontWeight: FontWeight.w500, fontSize: 16),
|
||||||
),
|
),
|
||||||
subtitle: Column(
|
subtitle: Column(
|
||||||
|
|
@ -82,6 +88,8 @@ class DriftBackupAssetDetailPage extends ConsumerWidget {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
error: (Object error, StackTrace stackTrace) {
|
error: (Object error, StackTrace stackTrace) {
|
||||||
return Center(child: Text('Error: $error'));
|
return Center(child: Text('Error: $error'));
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import 'package:immich_mobile/providers/infrastructure/setting.provider.dart';
|
||||||
import 'package:immich_mobile/providers/routes.provider.dart';
|
import 'package:immich_mobile/providers/routes.provider.dart';
|
||||||
import 'package:immich_mobile/providers/server_info.provider.dart';
|
import 'package:immich_mobile/providers/server_info.provider.dart';
|
||||||
import 'package:immich_mobile/providers/user.provider.dart';
|
import 'package:immich_mobile/providers/user.provider.dart';
|
||||||
|
import 'package:immich_mobile/repositories/asset_media.repository.dart';
|
||||||
import 'package:immich_mobile/utils/action_button.utils.dart';
|
import 'package:immich_mobile/utils/action_button.utils.dart';
|
||||||
import 'package:immich_mobile/utils/bytes_units.dart';
|
import 'package:immich_mobile/utils/bytes_units.dart';
|
||||||
import 'package:immich_mobile/widgets/common/immich_toast.dart';
|
import 'package:immich_mobile/widgets/common/immich_toast.dart';
|
||||||
|
|
@ -140,6 +141,47 @@ class _AssetDetailBottomSheet extends ConsumerWidget {
|
||||||
final exifInfo = ref.watch(currentAssetExifProvider).valueOrNull;
|
final exifInfo = ref.watch(currentAssetExifProvider).valueOrNull;
|
||||||
final cameraTitle = _getCameraInfoTitle(exifInfo);
|
final cameraTitle = _getCameraInfoTitle(exifInfo);
|
||||||
|
|
||||||
|
// Build file info tile based on asset type
|
||||||
|
Widget buildFileInfoTile() {
|
||||||
|
if (asset is LocalAsset) {
|
||||||
|
final assetMediaRepository = ref.watch(assetMediaRepositoryProvider);
|
||||||
|
return FutureBuilder<String?>(
|
||||||
|
future: assetMediaRepository.getOriginalFilename(asset.id),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
final displayName = snapshot.data ?? asset.name;
|
||||||
|
return _SheetTile(
|
||||||
|
title: displayName,
|
||||||
|
titleStyle: context.textTheme.labelLarge,
|
||||||
|
leading: Icon(
|
||||||
|
asset.isImage ? Icons.image_outlined : Icons.videocam_outlined,
|
||||||
|
size: 24,
|
||||||
|
color: context.textTheme.labelLarge?.color,
|
||||||
|
),
|
||||||
|
subtitle: _getFileInfo(asset, exifInfo),
|
||||||
|
subtitleStyle: context.textTheme.bodyMedium?.copyWith(
|
||||||
|
color: context.textTheme.bodyMedium?.color?.withAlpha(155),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// For remote assets, use the name directly
|
||||||
|
return _SheetTile(
|
||||||
|
title: asset.name,
|
||||||
|
titleStyle: context.textTheme.labelLarge,
|
||||||
|
leading: Icon(
|
||||||
|
asset.isImage ? Icons.image_outlined : Icons.videocam_outlined,
|
||||||
|
size: 24,
|
||||||
|
color: context.textTheme.labelLarge?.color,
|
||||||
|
),
|
||||||
|
subtitle: _getFileInfo(asset, exifInfo),
|
||||||
|
subtitleStyle: context.textTheme.bodyMedium?.copyWith(
|
||||||
|
color: context.textTheme.bodyMedium?.color?.withAlpha(155),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return SliverList.list(
|
return SliverList.list(
|
||||||
children: [
|
children: [
|
||||||
// Asset Date and Time
|
// Asset Date and Time
|
||||||
|
|
@ -161,19 +203,7 @@ class _AssetDetailBottomSheet extends ConsumerWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// File info
|
// File info
|
||||||
_SheetTile(
|
buildFileInfoTile(),
|
||||||
title: asset.name,
|
|
||||||
titleStyle: context.textTheme.labelLarge,
|
|
||||||
leading: Icon(
|
|
||||||
asset.isImage ? Icons.image_outlined : Icons.videocam_outlined,
|
|
||||||
size: 24,
|
|
||||||
color: context.textTheme.labelLarge?.color,
|
|
||||||
),
|
|
||||||
subtitle: _getFileInfo(asset, exifInfo),
|
|
||||||
subtitleStyle: context.textTheme.bodyMedium?.copyWith(
|
|
||||||
color: context.textTheme.bodyMedium?.color?.withAlpha(155),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
// Camera info
|
// Camera info
|
||||||
if (cameraTitle != null)
|
if (cameraTitle != null)
|
||||||
_SheetTile(
|
_SheetTile(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue