[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:
@@ -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;
|
||||
|
||||
@@ -40,6 +40,7 @@ class _MemoryProgressIndicatorState extends State<MemoryProgressIndicator>
|
||||
_animationController = AnimationController(
|
||||
vsync: this,
|
||||
duration: widget.duration,
|
||||
animationBehavior: AnimationBehavior.preserve,
|
||||
);
|
||||
|
||||
_animation =
|
||||
|
||||
Reference in New Issue
Block a user