Skip to content

armgit / ente

Public Imported from GitHub
0

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

Reuse rewind banner in discovery

laurenspriem246a8760c7f5
diff --git a/mobile/apps/photos/lib/ui/wrapped/wrapped_discovery_section.dart b/mobile/apps/photos/lib/ui/wrapped/wrapped_discovery_section.dart
index 4f3cfa3f2f..cd715d8113 100644
--- a/mobile/apps/photos/lib/ui/wrapped/wrapped_discovery_section.dart
+++ b/mobile/apps/photos/lib/ui/wrapped/wrapped_discovery_section.dart
@@ -1,10 +1,6 @@
import "package:flutter/material.dart";
-import "package:photos/service_locator.dart";
import "package:photos/services/wrapped/models.dart";
-import "package:photos/services/wrapped/wrapped_service.dart";
-import "package:photos/theme/ente_theme.dart";
-import "package:photos/ui/notification/toast.dart";
-import "package:photos/ui/wrapped/wrapped_viewer_page.dart";
+import "package:photos/ui/wrapped/wrapped_rewind_banner_button.dart";
class WrappedDiscoverySection extends StatelessWidget {
const WrappedDiscoverySection({
@@ -16,97 +12,20 @@ class WrappedDiscoverySection extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
-
final bool hasProgress = state.resumeIndex > 0 &&
state.resumeIndex < (state.result?.cards.length ?? 0);
- final String subtitle = state.isComplete
- ? "Replay the full story."
- : hasProgress
- ? "Resume from where you left off."
- : "Highlights from your 2025.";
+ final String semanticsLabel = hasProgress && !state.isComplete
+ ? "Resume Ente Rewind 2025"
+ : "Open Ente Rewind 2025";
return Padding(
padding: const EdgeInsets.fromLTRB(12, 16, 12, 32),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- "Ente Rewind",
- style: textTheme.largeBold,
- ),
- const SizedBox(height: 12),
- Material(
- color: colorScheme.backgroundElevated,
- borderRadius: BorderRadius.circular(18),
- child: InkWell(
- borderRadius: BorderRadius.circular(18),
- onTap: () => _handleTap(context),
- child: Padding(
- padding:
- const EdgeInsets.symmetric(horizontal: 16, vertical: 18),
- child: Row(
- children: [
- Icon(
- Icons.play_circle_fill_rounded,
- color: colorScheme.primary500,
- size: 36,
- ),
- const SizedBox(width: 14),
- Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- state.isComplete
- ? "Watch again"
- : hasProgress
- ? "Continue watching"
- : "View your recap",
- style: textTheme.largeBold,
- ),
- const SizedBox(height: 4),
- Text(
- subtitle,
- style: textTheme.smallMuted,
- ),
- ],
- ),
- ),
- const SizedBox(width: 8),
- Icon(
- Icons.chevron_right_rounded,
- color: colorScheme.textMuted,
- ),
- ],
- ),
- ),
- ),
- ),
- ],
- ),
- );
- }
-
- void _handleTap(BuildContext context) {
- WrappedEntryState currentState = wrappedService.state;
- final WrappedResult? result = currentState.result;
- if (result == null || result.cards.isEmpty) {
- showShortToast(context, "Ente Rewind isn't ready yet");
- return;
- }
- final int cardCount = result.cards.length;
- if (cardCount > 1 &&
- currentState.resumeIndex >= cardCount - 1 &&
- currentState.resumeIndex != 0) {
- wrappedService.updateResumeIndex(0);
- currentState = wrappedService.state;
- }
- Navigator.of(context).push(
- MaterialPageRoute<void>(
- builder: (BuildContext context) =>
- WrappedViewerPage(initialState: currentState),
+ child: SizedBox(
+ width: double.infinity,
+ child: WrappedRewindBannerButton(
+ height: 164,
+ semanticsLabel: semanticsLabel,
+ ),
),
);
}