[mobile] Fix memory edge cases (#6482)

## Description
Handle edge cases in memory tap when tapping -
1. On 1st memory of the 1st memory block - reset the animation
2. On last memory of the last memory block - do nothing 

## Test


https://github.com/user-attachments/assets/3358bf41-548e-403b-83a2-aabac7a94266
This commit is contained in:
Neeraj
2025-07-11 11:54:29 +05:30
committed by GitHub
2 changed files with 13 additions and 1 deletions

View File

@@ -153,6 +153,7 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {
/// Used to check if any pointer is on the screen.
final hasPointerOnScreenNotifier = ValueNotifier<bool>(false);
bool hasFinalFileLoaded = false;
bool isAtFirstOrLastFile = false;
late final StreamSubscription<DetailsSheetEvent>
_detailSheetEventSubscription;
@@ -219,7 +220,7 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {
_progressAnimationController?.stop();
_zoomAnimationController?.stop();
} else {
if (hasFinalFileLoaded) {
if (hasFinalFileLoaded || isAtFirstOrLastFile) {
_progressAnimationController?.forward();
_zoomAnimationController?.forward();
}
@@ -237,6 +238,7 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {
void onFinalFileLoad(int duration) {
hasFinalFileLoaded = true;
isAtFirstOrLastFile = false;
if (_progressAnimationController?.isAnimating == true) {
_progressAnimationController!.stop();
}
@@ -260,6 +262,9 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {
_onPageChange(inheritedData, currentIndex + 1);
} else if (widget.onNextMemory != null) {
widget.onNextMemory!();
} else {
isAtFirstOrLastFile = true;
_toggleAnimation(pause: false);
}
}
@@ -271,10 +276,15 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {
_onPageChange(inheritedData, currentIndex - 1);
} else if (widget.onPreviousMemory != null) {
widget.onPreviousMemory!();
} else {
isAtFirstOrLastFile = true;
_resetAnimation();
_toggleAnimation(pause: false);
}
}
void _onPageChange(FullScreenMemoryData inheritedData, int index) {
isAtFirstOrLastFile = false;
unawaited(
memoriesCacheService.markMemoryAsSeen(
inheritedData.memories[index],
@@ -709,6 +719,7 @@ class _MemoriesZoomWidgetState extends State<MemoriesZoomWidget>
duration: const Duration(
seconds: 5,
),
animationBehavior: AnimationBehavior.preserve,
);
final startScale = widget.zoomIn ? 1.05 : 1.15;

View File

@@ -40,6 +40,7 @@ class _MemoryProgressIndicatorState extends State<MemoryProgressIndicator>
_animationController = AnimationController(
vsync: this,
duration: widget.duration,
animationBehavior: AnimationBehavior.preserve,
);
_animation =