fix(mobile): not being able to zoom into live photos (#14608)

fix live photo zoom
This commit is contained in:
Mert 2024-12-11 12:23:20 -05:00 committed by GitHub
parent e40c7c51ee
commit 3053d84e49
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 33 deletions

View file

@ -61,6 +61,7 @@ class GalleryViewerPage extends HookConsumerWidget {
final localPosition = useRef<Offset?>(null);
final currentIndex = useValueNotifier(initialIndex);
final loadAsset = renderList.loadAsset;
final isPlayingMotionVideo = ref.watch(isPlayingMotionVideoProvider);
Future<void> precacheNextImage(int index) async {
if (!context.mounted) {
@ -249,7 +250,6 @@ class GalleryViewerPage extends HookConsumerWidget {
}
PhotoViewGalleryPageOptions buildAsset(BuildContext context, int index) {
ref.read(isPlayingMotionVideoProvider.notifier).playing = false;
var newAsset = loadAsset(index);
final stackId = newAsset.stackId;
if (stackId != null && currentIndex.value == index) {
@ -260,7 +260,7 @@ class GalleryViewerPage extends HookConsumerWidget {
}
}
if (newAsset.isImage && !newAsset.isMotionPhoto) {
if (newAsset.isImage && !isPlayingMotionVideo) {
return buildImage(context, newAsset);
}
return buildVideo(context, newAsset);
@ -275,7 +275,7 @@ class GalleryViewerPage extends HookConsumerWidget {
body: Stack(
children: [
PhotoViewGallery.builder(
key: const ValueKey('gallery'),
key: ValueKey(isPlayingMotionVideo),
scaleStateChangedCallback: (state) {
final asset = ref.read(currentAssetProvider);
if (asset == null) {