Skip to content

armgit / ente

Public Imported from GitHub
0

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

route to FullScreenMemory screen on tapping the new MemoryCoverWidget

ashilkn3a24e99003ae
diff --git a/lib/ui/home/memories/memory_cover_widget_new.dart b/lib/ui/home/memories/memory_cover_widget_new.dart
index 6cdd850287..d2f8b9fb08 100644
--- a/lib/ui/home/memories/memory_cover_widget_new.dart
+++ b/lib/ui/home/memories/memory_cover_widget_new.dart
@@ -1,9 +1,11 @@
import "package:flutter/material.dart";
import "package:photos/models/memory.dart";
import "package:photos/theme/ente_theme.dart";
+import "package:photos/ui/home/memories/full_screen_memory.dart";
import "package:photos/ui/viewer/file/thumbnail_widget.dart";
+import "package:photos/utils/navigation_util.dart";
-class MemoryCoverWidgetNew extends StatelessWidget {
+class MemoryCoverWidgetNew extends StatefulWidget {
final List<Memory> memories;
final ScrollController controller;
final double offsetOfItem;
@@ -15,65 +17,85 @@ class MemoryCoverWidgetNew extends StatelessWidget {
super.key,
});
+ @override
+ State<MemoryCoverWidgetNew> createState() => _MemoryCoverWidgetNewState();
+}
+
+class _MemoryCoverWidgetNewState extends State<MemoryCoverWidgetNew> {
@override
Widget build(BuildContext context) {
//memories will be empty if all memories are deleted and setState is called
//after FullScreenMemory screen is popped
- if (memories.isEmpty) {
+ if (widget.memories.isEmpty) {
return const SizedBox.shrink();
}
final widthOfScreen = MediaQuery.sizeOf(context).width;
return AnimatedBuilder(
- animation: controller,
+ animation: widget.controller,
builder: (context, child) {
- final diff = (controller.offset - offsetOfItem) + widthOfScreen / 7;
+ final diff = (widget.controller.offset - widget.offsetOfItem) +
+ widthOfScreen / 7;
final scale = 1 - (diff / widthOfScreen).abs() / 3;
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 2.5),
//Adding this row is a workaround for making height of memory cover
//render as 125 * scale. Without this, height of rendered memory
//cover will be 125.
- child: Row(
- children: [
- SizedBox(
- height: 125 * scale,
- width: 85 * scale,
- child: ClipRRect(
- borderRadius: BorderRadius.circular(5),
- child: Stack(
- fit: StackFit.expand,
- alignment: Alignment.bottomCenter,
- children: [
- child!,
- Positioned(
- bottom: 8 * scale,
- child: Transform.scale(
- scale: scale,
- child: SizedBox(
- width: 85,
- child: Padding(
- padding: const EdgeInsets.symmetric(
- horizontal: 8.0,
- ),
- child: Text(
- "1 year ago",
- style: getEnteTextTheme(context).miniBold,
+ child: GestureDetector(
+ onTap: () async {
+ await routeToPage(
+ context,
+ FullScreenMemoryDataUpdater(
+ initialIndex: 0,
+ memories: widget.memories,
+ child: FullScreenMemory("title", 0),
+ ),
+ forceCustomPageRoute: true,
+ );
+ setState(() {});
+ },
+ child: Row(
+ children: [
+ SizedBox(
+ height: 125 * scale,
+ width: 85 * scale,
+ child: ClipRRect(
+ borderRadius: BorderRadius.circular(5),
+ child: Stack(
+ fit: StackFit.expand,
+ alignment: Alignment.bottomCenter,
+ children: [
+ child!,
+ Positioned(
+ bottom: 8 * scale,
+ child: Transform.scale(
+ scale: scale,
+ child: SizedBox(
+ width: 85,
+ child: Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 8.0,
+ ),
+ child: Text(
+ "1 year ago",
+ style: getEnteTextTheme(context).miniBold,
+ ),
),
),
),
),
- ),
- ],
+ ],
+ ),
),
),
- ),
- ],
+ ],
+ ),
),
);
},
child: ThumbnailWidget(
- memories[0].file,
+ widget.memories[0].file,
shouldShowArchiveStatus: false,
),
);