diff --git a/lib/ui/home/memories/full_screen_memory.dart b/lib/ui/home/memories/full_screen_memory.dart index 5db46ef05..23c92adb1 100644 --- a/lib/ui/home/memories/full_screen_memory.dart +++ b/lib/ui/home/memories/full_screen_memory.dart @@ -276,43 +276,68 @@ class _FullScreenMemoryState extends State { } Widget _buildSwiper() { - return ExtentsPageView.extents( - itemBuilder: (BuildContext context, int index) { - if (index < widget.memories.length - 1) { - final nextFile = widget.memories[index + 1].file; - preloadThumbnail(nextFile); - preloadFile(nextFile); + return GestureDetector( + behavior: HitTestBehavior.translucent, + onTapDown: (TapDownDetails details) { + if (_shouldDisableScroll) { + return; } - final file = widget.memories[index].file; - return FileWidget( - file, - autoPlay: false, - tagPrefix: "memories", - shouldDisableScroll: (value) { + final screenWidth = MediaQuery.of(context).size.width; + final edgeWidth = screenWidth * 0.20; // 20% of screen width + if (details.localPosition.dx < edgeWidth) { + if (_index > 0) { + _pageController!.previousPage( + duration: const Duration(milliseconds: 250), + curve: Curves.ease, + ); + } + } else if (details.localPosition.dx > screenWidth - edgeWidth) { + if (_index < (widget.memories.length - 1)) { + _pageController!.nextPage( + duration: const Duration(milliseconds: 250), + curve: Curves.ease, + ); + } + } + }, + child: ExtentsPageView.extents( + itemBuilder: (BuildContext context, int index) { + if (index < widget.memories.length - 1) { + final nextFile = widget.memories[index + 1].file; + preloadThumbnail(nextFile); + preloadFile(nextFile); + } + final file = widget.memories[index].file; + return FileWidget( + file, + autoPlay: false, + tagPrefix: "memories", + shouldDisableScroll: (value) { + setState(() { + _shouldDisableScroll = value; + }); + }, + backgroundDecoration: const BoxDecoration( + color: Colors.transparent, + ), + ); + }, + itemCount: widget.memories.length, + controller: _pageController, + onPageChanged: (index) async { + unawaited( + MemoriesService.instance.markMemoryAsSeen(widget.memories[index]), + ); + if (mounted) { setState(() { - _shouldDisableScroll = value; + _index = index; }); - }, - backgroundDecoration: const BoxDecoration( - color: Colors.transparent, - ), - ); - }, - itemCount: widget.memories.length, - controller: _pageController, - onPageChanged: (index) async { - unawaited( - MemoriesService.instance.markMemoryAsSeen(widget.memories[index]), - ); - if (mounted) { - setState(() { - _index = index; - }); - } - }, - physics: _shouldDisableScroll - ? const NeverScrollableScrollPhysics() - : const PageScrollPhysics(), + } + }, + physics: _shouldDisableScroll + ? const NeverScrollableScrollPhysics() + : const PageScrollPhysics(), + ), ); } } diff --git a/pubspec.yaml b/pubspec.yaml index eaa7061d4..260ee88f9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -12,7 +12,7 @@ description: ente photos application # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 0.7.52+452 +version: 0.7.53+453 environment: sdk: '>=2.17.0 <3.0.0'