Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Add subtle animation when opening jump to date gallery

ashilkn4e014d2d1c3c
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart b/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart
index c32b7794c2..03e2761dc9 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart
@@ -5,6 +5,7 @@ import 'dart:math' as math;
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import "package:flutter/services.dart";
+import "package:flutter_animate/flutter_animate.dart";
import 'package:logging/logging.dart';
import 'package:photos/core/constants.dart';
import 'package:photos/core/event_bus.dart';
@@ -576,13 +577,19 @@ class GalleryState extends State<Gallery> {
!_completedJumpToDate &&
_allFilesLoaded &&
groupHeaderExtent != null) {
- WidgetsBinding.instance.addPostFrameCallback((_) {
+ WidgetsBinding.instance.addPostFrameCallback((_) async {
if (mounted) {
final offset = galleryGroups
.getOffsetOfGroupContainingFile(widget.fileToJumpTo!);
if (offset != null) {
_logger.info("Jumping to date at offset: $offset");
- _scrollController.jumpTo(offset);
+ _scrollController.jumpTo(offset - 50);
+ await Future.delayed(16.milliseconds);
+ await _scrollController.animateTo(
+ offset,
+ duration: 300.milliseconds,
+ curve: Curves.easeOutQuint,
+ );
_completedJumpToDate = true;
} else {
_logger.warning(
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/jump_to_date_gallery.dart b/mobile/apps/photos/lib/ui/viewer/gallery/jump_to_date_gallery.dart
index 28c461c2a3..117afbe00e 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/jump_to_date_gallery.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/jump_to_date_gallery.dart
@@ -93,7 +93,7 @@ class _JumpToDateGalleryState extends State<JumpToDateGallery> {
});
// Wait for gallery to build, then make it visible
- Future.delayed(const Duration(milliseconds: 500), () {
+ Future.delayed(const Duration(milliseconds: 300), () {
if (mounted) {
setState(() {
_loadState = GalleryLoadState.galleryReady;