fix(mobile): stale thumbnail cache (#18351)

* fix(mobile): stale thumbnail cache

* Revert height/width usage
This commit is contained in:
Alex 2025-05-19 09:25:27 -05:00 committed by GitHub
parent 9e47093501
commit 2431e04a09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 29 additions and 24 deletions

View file

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:immich_mobile/domain/models/store.model.dart';
import 'package:immich_mobile/entities/asset.entity.dart';
import 'package:immich_mobile/entities/store.entity.dart';
@ -76,39 +75,32 @@ class ImmichImage extends StatelessWidget {
);
}
final imageProviderInstance = ImmichImage.imageProvider(
asset: asset,
width: context.width,
height: context.height,
);
return OctoImage(
fadeInDuration: const Duration(milliseconds: 0),
fadeOutDuration: const Duration(milliseconds: 200),
fadeOutDuration: const Duration(milliseconds: 100),
placeholderBuilder: (context) {
if (placeholder != null) {
// Use the gray box placeholder
return placeholder!;
}
// No placeholder
return const SizedBox();
},
image: ImmichImage.imageProvider(
asset: asset,
width: context.width,
height: context.height,
),
image: imageProviderInstance,
width: width,
height: height,
fit: fit,
errorBuilder: (context, error, stackTrace) {
if (error is PlatformException &&
error.code == "The asset not found!") {
debugPrint(
"Asset ${asset?.localId} does not exist anymore on device!",
);
} else {
debugPrint(
"Error getting thumb for assetId=${asset?.localId}: $error",
);
}
imageProviderInstance.evict();
return Icon(
Icons.image_not_supported_outlined,
color: context.primaryColor,
size: 32,
color: Colors.red[200],
);
},
);