π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mobile][photos] Animate empty state illustrations (#14315)
Rakhul6dc61cee317e
diff --git a/mobile/apps/photos/assets/2.0x/empty_state_album_search.png b/mobile/apps/photos/assets/2.0x/empty_state_album_search.pngdeleted file mode 100644index 1caa125bb1..0000000000Binary files a/mobile/apps/photos/assets/2.0x/empty_state_album_search.png and /dev/null differdiff --git a/mobile/apps/photos/assets/2.0x/empty_state_archive.png b/mobile/apps/photos/assets/2.0x/empty_state_archive.pngdeleted file mode 100644index 587eb815ae..0000000000Binary files a/mobile/apps/photos/assets/2.0x/empty_state_archive.png and /dev/null differdiff --git a/mobile/apps/photos/assets/2.0x/empty_state_links.png b/mobile/apps/photos/assets/2.0x/empty_state_links.pngdeleted file mode 100644index 4983e5d068..0000000000Binary files a/mobile/apps/photos/assets/2.0x/empty_state_links.png and /dev/null differdiff --git a/mobile/apps/photos/assets/2.0x/empty_state_trash.png b/mobile/apps/photos/assets/2.0x/empty_state_trash.pngdeleted file mode 100644index ef3b38c6ab..0000000000Binary files a/mobile/apps/photos/assets/2.0x/empty_state_trash.png and /dev/null differdiff --git a/mobile/apps/photos/assets/3.0x/empty_state_album_search.png b/mobile/apps/photos/assets/3.0x/empty_state_album_search.pngdeleted file mode 100644index fb6a0d25eb..0000000000Binary files a/mobile/apps/photos/assets/3.0x/empty_state_album_search.png and /dev/null differdiff --git a/mobile/apps/photos/assets/3.0x/empty_state_archive.png b/mobile/apps/photos/assets/3.0x/empty_state_archive.pngdeleted file mode 100644index e98c575c5b..0000000000Binary files a/mobile/apps/photos/assets/3.0x/empty_state_archive.png and /dev/null differdiff --git a/mobile/apps/photos/assets/3.0x/empty_state_links.png b/mobile/apps/photos/assets/3.0x/empty_state_links.pngdeleted file mode 100644index 4d4e16b64e..0000000000Binary files a/mobile/apps/photos/assets/3.0x/empty_state_links.png and /dev/null differdiff --git a/mobile/apps/photos/assets/3.0x/empty_state_trash.png b/mobile/apps/photos/assets/3.0x/empty_state_trash.pngdeleted file mode 100644index 9febfb3045..0000000000Binary files a/mobile/apps/photos/assets/3.0x/empty_state_trash.png and /dev/null differdiff --git a/mobile/apps/photos/assets/empty_state_album_search.png b/mobile/apps/photos/assets/empty_state_album_search.pngdeleted file mode 100644index 8e5853439b..0000000000Binary files a/mobile/apps/photos/assets/empty_state_album_search.png and /dev/null differdiff --git a/mobile/apps/photos/assets/empty_state_archive.png b/mobile/apps/photos/assets/empty_state_archive.pngdeleted file mode 100644index 2a5fda2037..0000000000Binary files a/mobile/apps/photos/assets/empty_state_archive.png and /dev/null differdiff --git a/mobile/apps/photos/assets/empty_state_links.png b/mobile/apps/photos/assets/empty_state_links.pngdeleted file mode 100644index 3c3d43fa58..0000000000Binary files a/mobile/apps/photos/assets/empty_state_links.png and /dev/null differdiff --git a/mobile/apps/photos/assets/empty_state_trash.png b/mobile/apps/photos/assets/empty_state_trash.pngdeleted file mode 100644index 6de95dbee8..0000000000Binary files a/mobile/apps/photos/assets/empty_state_trash.png and /dev/null differdiff --git a/mobile/apps/photos/assets/ente-archive-ducky.riv b/mobile/apps/photos/assets/ente-archive-ducky.rivnew file mode 100644index 0000000000..4d50d8bac0Binary files /dev/null and b/mobile/apps/photos/assets/ente-archive-ducky.riv differdiff --git a/mobile/apps/photos/assets/ente-links-ducky.riv b/mobile/apps/photos/assets/ente-links-ducky.rivnew file mode 100644index 0000000000..c51480c7bbBinary files /dev/null and b/mobile/apps/photos/assets/ente-links-ducky.riv differdiff --git a/mobile/apps/photos/assets/ente-nomatch-ducky.riv b/mobile/apps/photos/assets/ente-nomatch-ducky.rivnew file mode 100644index 0000000000..29f298d2abBinary files /dev/null and b/mobile/apps/photos/assets/ente-nomatch-ducky.riv differdiff --git a/mobile/apps/photos/assets/ente-trash-ducky.riv b/mobile/apps/photos/assets/ente-trash-ducky.rivnew file mode 100644index 0000000000..3a23ed5cd2Binary files /dev/null and b/mobile/apps/photos/assets/ente-trash-ducky.riv differdiff --git a/mobile/apps/photos/changes/animated-empty-state-duckies.md b/mobile/apps/photos/changes/animated-empty-state-duckies.mdnew file mode 100644index 0000000000..9545217f38--- /dev/null+++ b/mobile/apps/photos/changes/animated-empty-state-duckies.md@@ -0,0 +1 @@+- Animated the illustrations for empty album search, trash, archive, and links.diff --git a/mobile/apps/photos/lib/ui/components/empty_state_component.dart b/mobile/apps/photos/lib/ui/components/empty_state_component.dartindex 994fcadfc4..650bd126c0 100644--- a/mobile/apps/photos/lib/ui/components/empty_state_component.dart+++ b/mobile/apps/photos/lib/ui/components/empty_state_component.dart@@ -1,10 +1,13 @@import "package:ente_components/ente_components.dart";import "package:flutter/material.dart";+import "package:photos/ui/components/empty_state_illustration.dart";class EmptyStateComponent extends StatelessWidget {const EmptyStateComponent({required this.assetPath,required this.title,+ this.animated = false,+ this.illustrationSize = const Size(204, 170),this.textWidth = 285,this.spacing = 20,this.padding = const EdgeInsets.all(24),@@ -14,6 +17,8 @@ class EmptyStateComponent extends StatelessWidget {final String assetPath;final String title;+ final bool animated;+ final Size illustrationSize;final double textWidth;final double spacing;final EdgeInsetsGeometry padding;@@ -30,7 +35,14 @@ class EmptyStateComponent extends StatelessWidget {child: Column(mainAxisSize: MainAxisSize.min,children: [- Image.asset(assetPath),+ if (animated)+ EmptyStateIllustration(+ key: ValueKey(assetPath),+ assetPath: assetPath,+ size: illustrationSize,+ )+ else+ Image.asset(assetPath),SizedBox(height: spacing),SizedBox(width: textWidth,diff --git a/mobile/apps/photos/lib/ui/components/empty_state_illustration.dart b/mobile/apps/photos/lib/ui/components/empty_state_illustration.dartnew file mode 100644index 0000000000..9289520e8b--- /dev/null+++ b/mobile/apps/photos/lib/ui/components/empty_state_illustration.dart@@ -0,0 +1,74 @@+import "package:flutter/material.dart";+import "package:rive/rive.dart" as rive;++class EmptyStateIllustration extends StatefulWidget {+ const EmptyStateIllustration({+ required this.assetPath,+ required this.size,+ super.key,+ });++ final String assetPath;+ final Size size;++ @override+ State<EmptyStateIllustration> createState() => _EmptyStateIllustrationState();+}++class _EmptyStateIllustrationState extends State<EmptyStateIllustration> {+ rive.File? _file;+ rive.RiveWidgetController? _controller;++ @override+ void initState() {+ super.initState();+ _load();+ }++ Future<void> _load() async {+ rive.File? file;+ try {+ file = await rive.File.asset(+ widget.assetPath,+ riveFactory: rive.Factory.flutter,+ );+ if (file == null) return;+ if (!mounted) {+ file.dispose();+ return;+ }+ final controller = rive.RiveWidgetController(file)..advance(0);+ setState(() {+ _file = file;+ _controller = controller;+ });+ } catch (_) {+ file?.dispose();+ }+ }++ @override+ void dispose() {+ _controller?.dispose();+ _file?.dispose();+ super.dispose();+ }++ @override+ Widget build(BuildContext context) {+ final controller = _controller;+ return SizedBox(+ width: widget.size.width,+ height: widget.size.height,+ child: controller == null+ ? null+ : TickerMode(+ enabled: !MediaQuery.disableAnimationsOf(context),+ child: rive.RiveWidget(+ controller: controller,+ fit: rive.Fit.contain,+ ),+ ),+ );+ }+}diff --git a/mobile/apps/photos/lib/ui/tabs/albums_tab.dart b/mobile/apps/photos/lib/ui/tabs/albums_tab.dartindex abaae072cf..98101ff52b 100644--- a/mobile/apps/photos/lib/ui/tabs/albums_tab.dart+++ b/mobile/apps/photos/lib/ui/tabs/albums_tab.dart@@ -50,11 +50,13 @@ class AlbumsTab extends StatefulWidget {const AlbumsTab({super.key,this.selectedAlbums,+ this.isActive = true,this.isSearchActiveNotifier,this.shouldConsumeBackNotifier,});final SelectedAlbums? selectedAlbums;+ final bool isActive;final ValueNotifier<bool>? isSearchActiveNotifier;final ValueNotifier<bool>? shouldConsumeBackNotifier;@@ -534,10 +536,15 @@ class _AlbumsTabState extends State<AlbumsTab>Widget _buildGlobalSearchEmptyStateSliver(StringsLocalizations strings) {return SliverFillRemaining(hasScrollBody: false,- child: EmptyStateComponent(- assetPath: "assets/empty_state_album_search.png",- title: strings.noMatchesFound,- textWidth: 240,+ child: TickerMode(+ enabled: widget.isActive,+ child: EmptyStateComponent(+ assetPath: "assets/ente-nomatch-ducky.riv",+ animated: true,+ illustrationSize: const Size(181, 138),+ title: strings.noMatchesFound,+ textWidth: 240,+ ),),);}diff --git a/mobile/apps/photos/lib/ui/tabs/home_widget.dart b/mobile/apps/photos/lib/ui/tabs/home_widget.dartindex 0b5c0fd147..5dd6ae59e3 100644--- a/mobile/apps/photos/lib/ui/tabs/home_widget.dart+++ b/mobile/apps/photos/lib/ui/tabs/home_widget.dart@@ -1124,6 +1124,7 @@ class _HomeWidgetState extends State<HomeWidget> {selectedTabIndex,AlbumsTab(selectedAlbums: _selectedAlbums,+ isActive: selectedTabIndex == 1,isSearchActiveNotifier:_isAlbumsSearchActiveNotifier,shouldConsumeBackNotifier:diff --git a/mobile/apps/photos/lib/ui/tabs/shared/all_links_page.dart b/mobile/apps/photos/lib/ui/tabs/shared/all_links_page.dartindex 7f565378fb..8d75815e7d 100644--- a/mobile/apps/photos/lib/ui/tabs/shared/all_links_page.dart+++ b/mobile/apps/photos/lib/ui/tabs/shared/all_links_page.dart@@ -281,7 +281,9 @@ class _AllLinksPageState extends State<AllLinksPage> {SliverFillRemaining(hasScrollBody: false,child: EmptyStateComponent(- assetPath: "assets/empty_state_links.png",+ assetPath: "assets/ente-links-ducky.riv",+ animated: true,+ illustrationSize: const Size(204, 171),title: context.strings.activeLinksWillShowUpHere,),),diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/archive_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/archive_page.dartindex 1223604832..8ab7cc2b4b 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/archive_page.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/archive_page.dart@@ -141,7 +141,9 @@ class _ArchivePageState extends State<ArchivePage> {initialFiles: null,emptyState: _archivedCollections.isEmpty? EmptyStateComponent(- assetPath: "assets/empty_state_archive.png",+ assetPath: "assets/ente-archive-ducky.riv",+ animated: true,+ illustrationSize: const Size(204, 173),title: context.strings.archivedItemsWillShowUpHere,): const SizedBox.shrink(),diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dartindex 32df075f01..61b14e2aab 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart@@ -136,7 +136,9 @@ class _TrashPageState extends State<_TrashPage> {selectedFiles: _selectedFiles,initialFiles: null,emptyState: EmptyStateComponent(- assetPath: "assets/empty_state_trash.png",+ assetPath: "assets/ente-trash-ducky.riv",+ animated: true,+ illustrationSize: const Size(204, 161),title: l10n.deletedItemsStayHereForThirtyDays,),),