From 412dfb139bd800a0ff36ef9b13cc7b4081061409 Mon Sep 17 00:00:00 2001 From: Pratik-canopas Date: Tue, 21 Jan 2025 14:43:08 +0530 Subject: [PATCH] Added info in all previews --- .../media_preview/media_preview_screen.dart | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/app/lib/ui/flow/media_preview/media_preview_screen.dart b/app/lib/ui/flow/media_preview/media_preview_screen.dart index 9197951..b2a39c8 100644 --- a/app/lib/ui/flow/media_preview/media_preview_screen.dart +++ b/app/lib/ui/flow/media_preview/media_preview_screen.dart @@ -232,11 +232,22 @@ class _MediaPreviewState extends ConsumerState { required AppMedia media, required bool isZoomed, }) { + void onDragUp(displacement) async { + if (displacement > 100) { + if (_videoPlayerController != null && + (_videoPlayerController?.value.isInitialized ?? false)) { + _videoPlayerController?.pause(); + } + MediaMetadataDetailsScreen.show(context, media); + } + } + if (media.type.isVideo && media.sources.contains(AppMediaSource.local)) { return DismissiblePage( backgroundColor: context.colorScheme.surface, enableScale: false, onDismiss: context.pop, + onDragUp: onDragUp, onDragDown: _notifier.updateSwipeDownPercentage, child: Center( child: Consumer( @@ -318,6 +329,7 @@ class _MediaPreviewState extends ConsumerState { enableScale: false, backgroundColor: context.colorScheme.surface, onDismiss: context.pop, + onDragUp: onDragUp, onDragDown: _notifier.updateSwipeDownPercentage, child: _cloudVideoView(context: context, media: media), ); @@ -328,12 +340,8 @@ class _MediaPreviewState extends ConsumerState { onScaleChange: (scale) { _notifier.updateIsImageZoomed(scale > 1); }, - onDragUp: (displacement) async { - if (displacement > 100) { - MediaMetadataDetailsScreen.show(context, media); - } - }, onDismiss: context.pop, + onDragUp: onDragUp, onDragDown: _notifier.updateSwipeDownPercentage, child: LocalMediaImagePreview(media: media, heroTag: widget.heroTag), ); @@ -345,6 +353,7 @@ class _MediaPreviewState extends ConsumerState { _notifier.updateIsImageZoomed(scale > 1); }, onDismiss: context.pop, + onDragUp: onDragUp, onDragDown: _notifier.updateSwipeDownPercentage, child: NetworkImagePreview(media: media, heroTag: widget.heroTag), );