feat(mobile): Adds better precaching for assets in gallery view and memory lane (#7486)

Adds better precaching for assets in gallery view and memory lane
This commit is contained in:
martyfuhry
2024-02-28 17:13:15 -05:00
committed by GitHub
parent d28abaad7b
commit b1a896ba61
2 changed files with 30 additions and 7 deletions
@@ -124,11 +124,14 @@ class MemoryPage extends HookConsumerWidget {
.then((_) => precacheAsset(1));
}
onAssetChanged(int otherIndex) {
Future<void> onAssetChanged(int otherIndex) async {
HapticFeedback.selectionClick();
currentAssetPage.value = otherIndex;
precacheAsset(otherIndex + 1);
updateProgressText();
// Wait for page change animation to finish
await Future.delayed(const Duration(milliseconds: 400));
// And then precache the next asset
await precacheAsset(otherIndex + 1);
}
/* Notification listener is used instead of OnPageChanged callback since OnPageChanged is called