From 72caf8983cecf7d755e6be3573f63c6a3ffe4bd0 Mon Sep 17 00:00:00 2001 From: Noel S Date: Tue, 20 Jan 2026 12:02:54 -0800 Subject: [PATCH] fix(mobile): indicators not showing on thumbnail tile after asset change in viewer (#25297) * fixed indicators staying hidden * remove logs * explanation comment * move import to correct place * revert accidental change in null handling --- .../widgets/images/thumbnail_tile.widget.dart | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mobile/lib/presentation/widgets/images/thumbnail_tile.widget.dart b/mobile/lib/presentation/widgets/images/thumbnail_tile.widget.dart index bdaf67ab7e..d6485ae7b6 100644 --- a/mobile/lib/presentation/widgets/images/thumbnail_tile.widget.dart +++ b/mobile/lib/presentation/widgets/images/thumbnail_tile.widget.dart @@ -6,6 +6,7 @@ import 'package:immich_mobile/domain/models/setting.model.dart'; import 'package:immich_mobile/extensions/build_context_extensions.dart'; import 'package:immich_mobile/extensions/duration_extensions.dart'; import 'package:immich_mobile/extensions/theme_extensions.dart'; +import 'package:immich_mobile/presentation/widgets/asset_viewer/asset_viewer.state.dart'; import 'package:immich_mobile/presentation/widgets/images/thumbnail.widget.dart'; import 'package:immich_mobile/presentation/widgets/timeline/constants.dart'; import 'package:immich_mobile/providers/backup/asset_upload_progress.provider.dart'; @@ -47,6 +48,7 @@ class _ThumbnailTileState extends ConsumerState { Widget build(BuildContext context) { final asset = widget.asset; final heroIndex = widget.heroOffset ?? TabsRouterScope.of(context)?.controller.activeIndex ?? 0; + final isCurrentAsset = ref.watch(assetViewerProvider.select((current) => current.currentAsset == asset)); final assetContainerColor = context.isDarkTheme ? context.primaryColor.darken(amount: 0.4) @@ -59,6 +61,10 @@ class _ThumbnailTileState extends ConsumerState { final bool storageIndicator = ref.watch(settingsProvider.select((s) => s.get(Setting.showStorageIndicator))) && widget.showStorageIndicator; + if (!isCurrentAsset) { + _hideIndicators = false; + } + if (isSelected) { _showSelectionContainer = true; } @@ -96,7 +102,11 @@ class _ThumbnailTileState extends ConsumerState { children: [ Positioned.fill( child: Hero( - tag: '${asset?.heroTag ?? ''}_$heroIndex', + // This key resets the hero animation when the asset is changed in the asset viewer. + // It doesn't seem like the best solution, and only works to reset the hero, not prime the hero of the new active asset for animation, + // but other solutions have failed thus far. + key: ValueKey(isCurrentAsset), + tag: '${asset?.heroTag}_$heroIndex', child: Thumbnail.fromAsset(asset: asset, size: widget.size), // Placeholderbuilder used to hide indicators on first hero animation, since flightShuttleBuilder isn't called until both source and destination hero exist in widget tree. placeholderBuilder: (context, heroSize, child) {