diff --git a/lib/generated/l10n.dart b/lib/generated/l10n.dart index 3380d8a8f..e882159ed 100644 --- a/lib/generated/l10n.dart +++ b/lib/generated/l10n.dart @@ -8307,16 +8307,6 @@ class S { args: [], ); } - - /// `Memories` - String get memories { - return Intl.message( - 'Memories', - name: 'memories', - desc: '', - args: [], - ); - } } class AppLocalizationDelegate extends LocalizationsDelegate { diff --git a/lib/l10n/intl_cs.arb b/lib/l10n/intl_cs.arb index 241fdf15e..6a71af50f 100644 --- a/lib/l10n/intl_cs.arb +++ b/lib/l10n/intl_cs.arb @@ -10,6 +10,5 @@ "selectALocation": "Select a location", "selectALocationFirst": "Select a location first", "changeLocationOfSelectedItems": "Change location of selected items?", - "editsToLocationWillOnlyBeSeenWithinEnte": "Edits to location will only be seen within Ente", - "memories": "Memories" + "editsToLocationWillOnlyBeSeenWithinEnte": "Edits to location will only be seen within Ente" } \ No newline at end of file diff --git a/lib/l10n/intl_de.arb b/lib/l10n/intl_de.arb index a0445b7d0..f64a91832 100644 --- a/lib/l10n/intl_de.arb +++ b/lib/l10n/intl_de.arb @@ -1178,6 +1178,5 @@ "selectALocationFirst": "Wähle zuerst einen Standort", "changeLocationOfSelectedItems": "Standort der gewählten Elemente ändern?", "editsToLocationWillOnlyBeSeenWithinEnte": "Änderungen des Standorts werden nur in ente sichtbar sein", - "cleanUncategorized": "Unkategorisiert leeren", - "memories": "Memories" + "cleanUncategorized": "Unkategorisiert leeren" } \ No newline at end of file diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index cef7ac405..ae31c07d6 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -1187,6 +1187,5 @@ "selectALocationFirst": "Select a location first", "changeLocationOfSelectedItems": "Change location of selected items?", "editsToLocationWillOnlyBeSeenWithinEnte": "Edits to location will only be seen within Ente", - "cleanUncategorized": "Clean Uncategorized", - "memories": "Memories" -} \ No newline at end of file + "cleanUncategorized": "Clean Uncategorized" +} diff --git a/lib/l10n/intl_es.arb b/lib/l10n/intl_es.arb index 41522054b..0720f8d3e 100644 --- a/lib/l10n/intl_es.arb +++ b/lib/l10n/intl_es.arb @@ -973,6 +973,5 @@ "selectALocation": "Select a location", "selectALocationFirst": "Select a location first", "changeLocationOfSelectedItems": "Change location of selected items?", - "editsToLocationWillOnlyBeSeenWithinEnte": "Edits to location will only be seen within Ente", - "memories": "Memories" + "editsToLocationWillOnlyBeSeenWithinEnte": "Edits to location will only be seen within Ente" } \ No newline at end of file diff --git a/lib/l10n/intl_fr.arb b/lib/l10n/intl_fr.arb index ddfdb7569..fe9c4c64c 100644 --- a/lib/l10n/intl_fr.arb +++ b/lib/l10n/intl_fr.arb @@ -1154,6 +1154,5 @@ "selectALocation": "Select a location", "selectALocationFirst": "Select a location first", "changeLocationOfSelectedItems": "Change location of selected items?", - "editsToLocationWillOnlyBeSeenWithinEnte": "Edits to location will only be seen within Ente", - "memories": "Memories" + "editsToLocationWillOnlyBeSeenWithinEnte": "Edits to location will only be seen within Ente" } \ No newline at end of file diff --git a/lib/l10n/intl_it.arb b/lib/l10n/intl_it.arb index 1a6735bba..7df3892f5 100644 --- a/lib/l10n/intl_it.arb +++ b/lib/l10n/intl_it.arb @@ -1116,6 +1116,5 @@ "selectALocation": "Select a location", "selectALocationFirst": "Select a location first", "changeLocationOfSelectedItems": "Change location of selected items?", - "editsToLocationWillOnlyBeSeenWithinEnte": "Edits to location will only be seen within Ente", - "memories": "Memories" + "editsToLocationWillOnlyBeSeenWithinEnte": "Edits to location will only be seen within Ente" } \ No newline at end of file diff --git a/lib/l10n/intl_ko.arb b/lib/l10n/intl_ko.arb index 241fdf15e..6a71af50f 100644 --- a/lib/l10n/intl_ko.arb +++ b/lib/l10n/intl_ko.arb @@ -10,6 +10,5 @@ "selectALocation": "Select a location", "selectALocationFirst": "Select a location first", "changeLocationOfSelectedItems": "Change location of selected items?", - "editsToLocationWillOnlyBeSeenWithinEnte": "Edits to location will only be seen within Ente", - "memories": "Memories" + "editsToLocationWillOnlyBeSeenWithinEnte": "Edits to location will only be seen within Ente" } \ No newline at end of file diff --git a/lib/l10n/intl_nl.arb b/lib/l10n/intl_nl.arb index 009821332..bb8404dc4 100644 --- a/lib/l10n/intl_nl.arb +++ b/lib/l10n/intl_nl.arb @@ -1163,6 +1163,5 @@ "selectALocation": "Select a location", "selectALocationFirst": "Select a location first", "changeLocationOfSelectedItems": "Change location of selected items?", - "editsToLocationWillOnlyBeSeenWithinEnte": "Edits to location will only be seen within Ente", - "memories": "Memories" + "editsToLocationWillOnlyBeSeenWithinEnte": "Edits to location will only be seen within Ente" } \ No newline at end of file diff --git a/lib/l10n/intl_no.arb b/lib/l10n/intl_no.arb index 58981e01f..d55787f17 100644 --- a/lib/l10n/intl_no.arb +++ b/lib/l10n/intl_no.arb @@ -24,6 +24,5 @@ "selectALocation": "Select a location", "selectALocationFirst": "Select a location first", "changeLocationOfSelectedItems": "Change location of selected items?", - "editsToLocationWillOnlyBeSeenWithinEnte": "Edits to location will only be seen within Ente", - "memories": "Memories" + "editsToLocationWillOnlyBeSeenWithinEnte": "Edits to location will only be seen within Ente" } \ No newline at end of file diff --git a/lib/l10n/intl_pl.arb b/lib/l10n/intl_pl.arb index 16d20a38f..7dfb7abc1 100644 --- a/lib/l10n/intl_pl.arb +++ b/lib/l10n/intl_pl.arb @@ -111,6 +111,5 @@ "selectALocation": "Select a location", "selectALocationFirst": "Select a location first", "changeLocationOfSelectedItems": "Change location of selected items?", - "editsToLocationWillOnlyBeSeenWithinEnte": "Edits to location will only be seen within Ente", - "memories": "Memories" + "editsToLocationWillOnlyBeSeenWithinEnte": "Edits to location will only be seen within Ente" } \ No newline at end of file diff --git a/lib/l10n/intl_pt.arb b/lib/l10n/intl_pt.arb index e403970cc..e0232c58e 100644 --- a/lib/l10n/intl_pt.arb +++ b/lib/l10n/intl_pt.arb @@ -277,6 +277,5 @@ "selectALocation": "Select a location", "selectALocationFirst": "Select a location first", "changeLocationOfSelectedItems": "Change location of selected items?", - "editsToLocationWillOnlyBeSeenWithinEnte": "Edits to location will only be seen within Ente", - "memories": "Memories" + "editsToLocationWillOnlyBeSeenWithinEnte": "Edits to location will only be seen within Ente" } \ No newline at end of file diff --git a/lib/l10n/intl_zh.arb b/lib/l10n/intl_zh.arb index b6ba24221..730c2bf5e 100644 --- a/lib/l10n/intl_zh.arb +++ b/lib/l10n/intl_zh.arb @@ -1187,6 +1187,5 @@ "selectALocationFirst": "首先选择一个位置", "changeLocationOfSelectedItems": "确定要更改所选项目的位置吗?", "editsToLocationWillOnlyBeSeenWithinEnte": "对位置的编辑只能在 Ente 内看到", - "cleanUncategorized": "清除未分类的", - "memories": "回忆" + "cleanUncategorized": "清除未分类的" } \ No newline at end of file diff --git a/lib/services/memories_service.dart b/lib/services/memories_service.dart index 2bfefcb2f..646113128 100644 --- a/lib/services/memories_service.dart +++ b/lib/services/memories_service.dart @@ -85,6 +85,7 @@ class MemoriesService extends ChangeNotifier { } Future> _fetchMemories() async { + final stopWatch = Stopwatch()..start(); _logger.info("Fetching memories"); final presentTime = DateTime.now(); final present = presentTime.subtract( @@ -121,6 +122,8 @@ class MemoriesService extends ChangeNotifier { } } _cachedMemories = memories; + stopWatch.stop(); + _logger.info("Fetched memories, duration: ${stopWatch.elapsed}"); return _cachedMemories!; } diff --git a/lib/ui/home/memories/memories_widget.dart b/lib/ui/home/memories/memories_widget.dart index 6d1c9aa65..09f279ca1 100644 --- a/lib/ui/home/memories/memories_widget.dart +++ b/lib/ui/home/memories/memories_widget.dart @@ -1,12 +1,12 @@ import "dart:async"; import 'package:flutter/material.dart'; +import "package:flutter_animate/flutter_animate.dart"; import "package:photos/core/event_bus.dart"; import "package:photos/events/memories_setting_changed.dart"; -import "package:photos/generated/l10n.dart"; import 'package:photos/models/memory.dart'; import 'package:photos/services/memories_service.dart'; -import "package:photos/theme/ente_theme.dart"; +import "package:photos/ui/common/loading_widget.dart"; import 'package:photos/ui/home/memories/memory_cover_widget.dart'; class MemoriesWidget extends StatefulWidget { @@ -17,9 +17,10 @@ class MemoriesWidget extends StatefulWidget { } class _MemoriesWidgetState extends State { - final double _widthOfItem = 85; late ScrollController _controller; late StreamSubscription _subscription; + late double _maxHeight; + late double _maxWidth; @override void initState() { @@ -32,6 +33,16 @@ class _MemoriesWidgetState extends State { _controller = ScrollController(); } + @override + void didChangeDependencies() { + super.didChangeDependencies(); + final screenWidth = MediaQuery.sizeOf(context).width; + //factor will be 2 for most phones in portrait mode + final factor = (screenWidth / 220).ceil(); + _maxWidth = screenWidth / (factor * 2); + _maxHeight = _maxWidth / MemoryCoverWidget.aspectRatio; + } + @override void dispose() { _subscription.cancel(); @@ -48,34 +59,14 @@ class _MemoriesWidgetState extends State { future: MemoriesService.instance.getMemories(), builder: (context, snapshot) { if (snapshot.hasError || !snapshot.hasData || snapshot.data!.isEmpty) { - return const SizedBox.shrink(); + return SizedBox( + height: _maxHeight + 12 + 10, + child: const EnteLoadingWidget(), + ); } else { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 12.0), - child: Stack( - alignment: Alignment.centerRight, - children: [ - const RotationTransition( - turns: AlwaysStoppedAnimation(20 / 360), - child: Icon( - Icons.favorite_rounded, - color: Color.fromRGBO(0, 179, 60, 0.3), - size: 32, - ), - ), - Padding( - padding: const EdgeInsets.only(right: 16), - child: Text( - S.of(context).memories, - style: getEnteTextTheme(context).body, - ), - ), - ], - ), - ), const SizedBox( height: 12, ), @@ -92,19 +83,27 @@ class _MemoriesWidgetState extends State { final collatedMemories = _collateMemories(memories); return SizedBox( - height: MemoryCoverWidget.height, + height: _maxHeight, child: ListView.builder( physics: const BouncingScrollPhysics(), scrollDirection: Axis.horizontal, controller: _controller, itemCount: collatedMemories.length, itemBuilder: (context, itemIndex) { - final offsetOfItem = _widthOfItem * itemIndex; + final offsetOfItem = _maxWidth * itemIndex; return MemoryCoverWidget( memories: collatedMemories[itemIndex], controller: _controller, offsetOfItem: offsetOfItem, - ); + maxHeight: _maxHeight, + maxWidth: _maxWidth, + ) + .animate(delay: Duration(milliseconds: 75 * itemIndex)) + .fadeIn( + duration: const Duration(milliseconds: 250), + curve: Curves.easeInOutCubic, + ) + .slideX(begin: 0.04, end: 0); }, ), ); diff --git a/lib/ui/home/memories/memory_cover_widget.dart b/lib/ui/home/memories/memory_cover_widget.dart index 76e9a929a..ba2e4a736 100644 --- a/lib/ui/home/memories/memory_cover_widget.dart +++ b/lib/ui/home/memories/memory_cover_widget.dart @@ -10,14 +10,17 @@ class MemoryCoverWidget extends StatefulWidget { final List memories; final ScrollController controller; final double offsetOfItem; + final double maxHeight; + final double maxWidth; static const centerStrokeWidth = 1.0; - static const width = 85.0; - static const height = 125.0; + static const aspectRatio = 0.68; const MemoryCoverWidget({ required this.memories, required this.controller, required this.offsetOfItem, + required this.maxHeight, + required this.maxWidth, super.key, }); @@ -46,7 +49,7 @@ class _MemoryCoverWidgetState extends State { builder: (context, child) { final diff = (widget.controller.offset - widget.offsetOfItem) + widthOfScreen / 7; - final scale = 1 - (diff / widthOfScreen).abs() / 3; + final scale = 1 - (diff / widthOfScreen).abs() / 3.7; return Padding( padding: const EdgeInsets.symmetric(horizontal: 2.5), //Adding this row is a workaround for making height of memory cover @@ -68,8 +71,8 @@ class _MemoryCoverWidgetState extends State { child: Row( children: [ Container( - height: MemoryCoverWidget.height * scale, - width: MemoryCoverWidget.width * scale, + height: widget.maxHeight * scale, + width: widget.maxWidth * scale, decoration: BoxDecoration( boxShadow: [ BoxShadow( @@ -132,13 +135,13 @@ class _MemoryCoverWidgetState extends State { : Container( decoration: const BoxDecoration( gradient: LinearGradient( - stops: [0, 0.35, 0.5], + stops: [0, 0.27, 0.4], colors: [ - Color.fromARGB(71, 1, 222, 78), - Color(0x1901DE4D), - Color(0x0001DE4D), + Color.fromRGBO(1, 222, 78, 0.293), + Color.fromRGBO(1, 222, 77, 0.07), + Colors.transparent, ], - transform: GradientRotation(-1.2), + transform: GradientRotation(-1.1), ), ), ), @@ -157,16 +160,18 @@ class _MemoryCoverWidgetState extends State { child: Container( decoration: const BoxDecoration( gradient: LinearGradient( - stops: [0, 0.5, 1], + stops: [0, 0.1, 0.5, 0.9, 1], colors: [ Colors.transparent, - Color(0xFF01DE4D), + Color.fromRGBO(1, 222, 77, 0.1), + Color.fromRGBO(1, 222, 77, 1), + Color.fromRGBO(1, 222, 77, 0.1), Colors.transparent, ], ), ), height: 1 * scale, - width: 68 * scale, + width: (widget.maxWidth - 16) * scale, ), ), ], @@ -178,7 +183,7 @@ class _MemoryCoverWidgetState extends State { child: Transform.scale( scale: scale, child: SizedBox( - width: MemoryCoverWidget.width, + width: widget.maxWidth, child: Padding( padding: const EdgeInsets.symmetric( horizontal: 8.0, diff --git a/pubspec.yaml b/pubspec.yaml index 3f6f66a63..fbbf42df5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -12,7 +12,7 @@ description: ente photos application # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 0.8.36+556 +version: 0.8.38+558 environment: sdk: ">=3.0.0 <4.0.0"