1
0
mirror of https://github.com/immich-app/immich.git synced 2025-06-20 04:15:46 +02:00

fix(mobile): unique hero tag for assets from api response (#4600)

* fix(mobile): render error on switching asset while video playing

* fix(mobile): generate proper hero tags for assets from DTOs

---------

Co-authored-by: shalong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
shenlong
2023-10-23 18:28:12 +00:00
committed by GitHub
parent dd52ff2d33
commit 28d35bf04e
3 changed files with 19 additions and 7 deletions

View File

@ -5,6 +5,7 @@ import 'package:immich_mobile/routing/router.dart';
import 'package:immich_mobile/shared/models/asset.dart';
import 'package:immich_mobile/shared/ui/immich_image.dart';
import 'package:immich_mobile/utils/storage_indicator.dart';
import 'package:isar/isar.dart';
class ThumbnailImage extends StatelessWidget {
final Asset asset;
@ -41,6 +42,8 @@ class ThumbnailImage extends StatelessWidget {
final isDarkTheme = Theme.of(context).brightness == Brightness.dark;
final assetContainerColor =
isDarkTheme ? Colors.blueGrey : Theme.of(context).primaryColorLight;
// Assets from response DTOs do not have an isar id, querying which would give us the default autoIncrement id
final isFromResponse = asset.id == Isar.autoIncrement;
Widget buildSelectionIcon(Asset asset) {
if (isSelected) {
@ -129,7 +132,9 @@ class ThumbnailImage extends StatelessWidget {
width: 300,
height: 300,
child: Hero(
tag: asset.id + heroOffset,
tag: isFromResponse
? '${asset.remoteId}-$heroOffset'
: asset.id + heroOffset,
child: ImmichImage(
asset,
useGrayBoxPlaceholder: useGrayBoxPlaceholder,