Skip to content

armgit / ente

Public Imported from GitHub
0

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

Fix autoplay on very large memories

laurenspriemc3db711b331c
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 864986f525..ccd682ee3f 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
@@ -310,7 +310,8 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {
@override
Widget build(BuildContext context) {
final inheritedData = FullScreenMemoryData.of(context)!;
- final showStepProgressIndicator = inheritedData.memories.length < 60;
+ final showStepProgressIndicator =
+ inheritedData.memories.length < kMemoryProgressTickCutoff;
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 4.0),
@@ -343,28 +344,26 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 32),
- showStepProgressIndicator
- ? ValueListenableBuilder<Duration>(
- valueListenable: durationNotifier,
- builder: (context, duration, _) {
- return MemoryProgressIndicator(
- totalSteps: inheritedData.memories.length,
- currentIndex: value,
- selectedColor: Colors.white,
- unselectedColor: Colors.white.withValues(
- alpha: 0.4,
- ),
- duration: duration,
- animationController: (controller) {
- _progressAnimationController = controller;
- },
- onComplete: () {
- _goToNext(inheritedData);
- },
- );
- },
- )
- : const SizedBox.shrink(),
+ ValueListenableBuilder<Duration>(
+ valueListenable: durationNotifier,
+ builder: (context, duration, _) {
+ return MemoryProgressIndicator(
+ totalSteps: inheritedData.memories.length,
+ currentIndex: value,
+ selectedColor: Colors.white,
+ unselectedColor: Colors.white.withValues(
+ alpha: 0.4,
+ ),
+ duration: duration,
+ animationController: (controller) {
+ _progressAnimationController = controller;
+ },
+ onComplete: () {
+ _goToNext(inheritedData);
+ },
+ );
+ },
+ ),
const SizedBox(height: 6),
Row(
children: [
diff --git a/mobile/apps/photos/lib/ui/home/memories/memory_progress_indicator.dart b/mobile/apps/photos/lib/ui/home/memories/memory_progress_indicator.dart
index 3cfc42253c..413f737e01 100644
--- a/mobile/apps/photos/lib/ui/home/memories/memory_progress_indicator.dart
+++ b/mobile/apps/photos/lib/ui/home/memories/memory_progress_indicator.dart
@@ -1,5 +1,7 @@
import "package:flutter/material.dart";
+const int kMemoryProgressTickCutoff = 60;
+
class MemoryProgressIndicator extends StatefulWidget {
final int totalSteps;
final int currentIndex;
@@ -65,6 +67,12 @@ class _MemoryProgressIndicatorState extends State<MemoryProgressIndicator>
@override
Widget build(BuildContext context) {
+ // For very large memories, hide the tick bar (it would render as pixel-thin
+ // slivers). The animation controller keeps running so auto-advance still
+ // fires via onComplete.
+ if (widget.totalSteps >= kMemoryProgressTickCutoff) {
+ return const SizedBox.shrink();
+ }
return Row(
children: List.generate(widget.totalSteps, (index) {
return Expanded(