Skip to content

armgit / ente

Public Imported from GitHub
0

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

crossfade when entering memory

laurenspriemc1647865be98
diff --git a/mobile/apps/photos/lib/ui/home/memories/full_screen_memory.dart b/mobile/apps/photos/lib/ui/home/memories/full_screen_memory.dart
index 56b1b20d29..135690f1fe 100644
--- a/mobile/apps/photos/lib/ui/home/memories/full_screen_memory.dart
+++ b/mobile/apps/photos/lib/ui/home/memories/full_screen_memory.dart
@@ -287,6 +287,10 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {
// slower/cinematic for auto-advance. Set at the call site before the
// index bump so AnimatedSwitcher reads the right duration on rebuild.
bool _autoAdvanceTransition = false;
+ // One-shot "curtain rises" fade on the first photo of a memory.
+ // AnimatedSwitcher doesn't animate its initial child, so we wrap it
+ // in an AnimatedOpacity that ramps 0β†’1 after the first frame.
+ double _firstPhotoOpacity = 0;
/// Used to check if any pointer is on the screen.
final hasPointerOnScreenNotifier = ValueNotifier<bool>(false);
@@ -299,6 +303,9 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {
@override
void initState() {
super.initState();
+ WidgetsBinding.instance.addPostFrameCallback((_) {
+ if (mounted) setState(() => _firstPhotoOpacity = 1);
+ });
Future.delayed(const Duration(seconds: 3), () {
if (mounted) _showTitle.value = false;
});
@@ -620,44 +627,52 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {
}
},
hasPointerNotifier: hasPointerOnScreenNotifier,
- child: AnimatedSwitcher(
- duration: _autoAdvanceTransition
- ? const Duration(milliseconds: 600)
- : const Duration(milliseconds: 200),
- switchInCurve: Curves.easeOut,
- switchOutCurve: Curves.easeIn,
- layoutBuilder: (currentChild, previousChildren) {
- return Stack(
- fit: StackFit.expand,
- children: [
- ...previousChildren,
- if (currentChild != null) currentChild,
- ],
- );
- },
- child: MemoriesZoomWidget(
- key: ValueKey(
- currentFile.uploadedFileID ?? currentFile.localID,
- ),
- scaleController: (controller) {
- _zoomAnimationController = controller;
+ child: AnimatedOpacity(
+ opacity: _firstPhotoOpacity,
+ duration: const Duration(milliseconds: 400),
+ curve: Curves.easeOut,
+ child: AnimatedSwitcher(
+ duration: _autoAdvanceTransition
+ ? const Duration(milliseconds: 600)
+ : const Duration(milliseconds: 200),
+ switchInCurve: Curves.easeOut,
+ switchOutCurve: Curves.easeIn,
+ layoutBuilder: (currentChild, previousChildren) {
+ return Stack(
+ fit: StackFit.expand,
+ children: [
+ ...previousChildren,
+ if (currentChild != null) currentChild,
+ ],
+ );
},
- zoomIn: index % 2 == 0,
- isVideo: isVideo,
- child: FileWidget(
- currentFile,
- autoPlay: false,
- tagPrefix: "memories",
- backgroundDecoration: const BoxDecoration(
- color: Colors.transparent,
+ child: MemoriesZoomWidget(
+ key: ValueKey(
+ currentFile.uploadedFileID ??
+ currentFile.localID,
),
- isFromMemories: true,
- playbackCallback: (shouldEnable, _) {
- _toggleAnimation(pause: !shouldEnable);
- },
- onFinalFileLoad: ({required int memoryDuration}) {
- onFinalFileLoad(memoryDuration);
+ scaleController: (controller) {
+ _zoomAnimationController = controller;
},
+ zoomIn: index % 2 == 0,
+ isVideo: isVideo,
+ child: FileWidget(
+ currentFile,
+ autoPlay: false,
+ tagPrefix: "memories",
+ backgroundDecoration: const BoxDecoration(
+ color: Colors.transparent,
+ ),
+ isFromMemories: true,
+ playbackCallback: (shouldEnable, _) {
+ _toggleAnimation(pause: !shouldEnable);
+ },
+ onFinalFileLoad: ({
+ required int memoryDuration,
+ }) {
+ onFinalFileLoad(memoryDuration);
+ },
+ ),
),
),
),