higher res placeholder for local videos

This commit is contained in:
mertalev
2024-11-08 21:19:12 -05:00
parent 5766551447
commit 64e23a3b5c
5 changed files with 75 additions and 37 deletions
@@ -100,7 +100,11 @@ class GalleryViewerPage extends HookConsumerWidget {
if (index < totalAssets.value && index >= 0) {
final asset = loadAsset(index);
await precacheImage(
ImmichImage.imageProvider(asset: asset),
ImmichImage.imageProvider(
asset: asset,
width: context.width,
height: context.height,
),
context,
onError: onError,
);
@@ -313,7 +317,11 @@ class GalleryViewerPage extends HookConsumerWidget {
asset: asset,
placeholder: Image(
key: ValueKey(asset),
image: ImmichImage.imageProvider(asset: asset),
image: ImmichImage.imageProvider(
asset: asset,
width: context.width,
height: context.height,
),
fit: BoxFit.contain,
height: context.height,
width: context.width,
@@ -396,12 +404,7 @@ class GalleryViewerPage extends HookConsumerWidget {
stackIndex.value = -1;
isPlayingMotionVideo.value = false;
// Delay setting the new asset to avoid a stutter in the page change animation
// TODO: make the scroll animation finish more quickly, and ideally have a callback for when it's done
ref.read(currentAssetProvider.notifier).set(newAsset);
// Timer(const Duration(milliseconds: 450), () {
// ref.read(currentAssetProvider.notifier).set(newAsset);
// });
// Wait for page change animation to finish, then precache the next image
Timer(const Duration(milliseconds: 400), () {
+4
View File
@@ -113,11 +113,15 @@ class MemoryPage extends HookConsumerWidget {
}
// Precache the asset
final size = MediaQuery.sizeOf(context);
await precacheImage(
ImmichImage.imageProvider(
asset: asset,
width: size.width,
height: size.height,
),
context,
size: size,
);
}