Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][photos] Add redesigned empty states (#10632)

Aman Rajb7728bb1bff7
diff --git a/mobile/apps/photos/assets/2.0x/feed.png b/mobile/apps/photos/assets/2.0x/feed.png
new file mode 100644
index 0000000000..09106b1ddc
Binary files /dev/null and b/mobile/apps/photos/assets/2.0x/feed.png differ
diff --git a/mobile/apps/photos/assets/2.0x/on_device.png b/mobile/apps/photos/assets/2.0x/on_device.png
new file mode 100644
index 0000000000..d1e5dbb7d4
Binary files /dev/null and b/mobile/apps/photos/assets/2.0x/on_device.png differ
diff --git a/mobile/apps/photos/assets/2.0x/on_ente.png b/mobile/apps/photos/assets/2.0x/on_ente.png
new file mode 100644
index 0000000000..8d27ad3f0c
Binary files /dev/null and b/mobile/apps/photos/assets/2.0x/on_ente.png differ
diff --git a/mobile/apps/photos/assets/2.0x/shared.png b/mobile/apps/photos/assets/2.0x/shared.png
new file mode 100644
index 0000000000..085a64f27c
Binary files /dev/null and b/mobile/apps/photos/assets/2.0x/shared.png differ
diff --git a/mobile/apps/photos/assets/3.0x/feed.png b/mobile/apps/photos/assets/3.0x/feed.png
new file mode 100644
index 0000000000..7be970a841
Binary files /dev/null and b/mobile/apps/photos/assets/3.0x/feed.png differ
diff --git a/mobile/apps/photos/assets/3.0x/on_device.png b/mobile/apps/photos/assets/3.0x/on_device.png
new file mode 100644
index 0000000000..84114eae76
Binary files /dev/null and b/mobile/apps/photos/assets/3.0x/on_device.png differ
diff --git a/mobile/apps/photos/assets/3.0x/on_ente.png b/mobile/apps/photos/assets/3.0x/on_ente.png
new file mode 100644
index 0000000000..edbd4f4815
Binary files /dev/null and b/mobile/apps/photos/assets/3.0x/on_ente.png differ
diff --git a/mobile/apps/photos/assets/3.0x/shared.png b/mobile/apps/photos/assets/3.0x/shared.png
new file mode 100644
index 0000000000..c44c6cf745
Binary files /dev/null and b/mobile/apps/photos/assets/3.0x/shared.png differ
diff --git a/mobile/apps/photos/assets/feed.png b/mobile/apps/photos/assets/feed.png
new file mode 100644
index 0000000000..031c7edd11
Binary files /dev/null and b/mobile/apps/photos/assets/feed.png differ
diff --git a/mobile/apps/photos/assets/on_device.png b/mobile/apps/photos/assets/on_device.png
new file mode 100644
index 0000000000..01d63f6898
Binary files /dev/null and b/mobile/apps/photos/assets/on_device.png differ
diff --git a/mobile/apps/photos/assets/on_ente.png b/mobile/apps/photos/assets/on_ente.png
new file mode 100644
index 0000000000..31fc95ba05
Binary files /dev/null and b/mobile/apps/photos/assets/on_ente.png differ
diff --git a/mobile/apps/photos/assets/shared.png b/mobile/apps/photos/assets/shared.png
new file mode 100644
index 0000000000..e895ef8f14
Binary files /dev/null and b/mobile/apps/photos/assets/shared.png differ
diff --git a/mobile/apps/photos/lib/l10n/intl_en.arb b/mobile/apps/photos/lib/l10n/intl_en.arb
index ff47b8f25c..0c80ad7a8f 100644
--- a/mobile/apps/photos/lib/l10n/intl_en.arb
+++ b/mobile/apps/photos/lib/l10n/intl_en.arb
@@ -1063,6 +1063,21 @@
"allowAccessToYourPhotos": "Allow access to your photos",
"enteNeedsPermissionToSeeDeviceAlbums": "Ente needs permission to see your device albums",
"allYourDeviceAlbumsInOnePlace": "All your device albums, in one place",
+ "albumsOnEnteEmptyTitle": "Back up your memories",
+ "albumsOnEnteEmptyFeatureAccessAnyDevice": "Access them on any device",
+ "albumsOnEnteEmptyFeatureShareLovedOnes": "Share them with loved ones - they can react and chat, without an account",
+ "albumsOnEnteEmptyFeaturePrivacy": "Full privacy with end-to-end encryption",
+ "albumsOnEnteEmptyCta": "Select albums to backup",
+ "albumsSharedEmptyTitle": "Share your memories",
+ "albumsSharedEmptyFeatureShareLovedOnes": "Share your photos and videos with loved ones",
+ "albumsSharedEmptyFeatureReactAndComment": "They can view, react and add comments, without an account",
+ "albumsSharedEmptyFeaturePrivacy": "Full privacy with end-to-end encryption",
+ "albumsOnDevicePermissionCta": "Allow access",
+ "albumsOnDevicePermissionFeatureAllowAccessFaceRecognition": "Allow Ente to access and organize your photos with face recognition",
+ "albumsOnDevicePermissionFeatureLocalProcessing": "All processing happens on your device",
+ "albumsOnDevicePermissionFeatureControlUploads": "You're in control of what gets uploaded",
+ "noAlbumsOnThisDevice": "No albums\non this device",
+ "startSnappingYourPhotosWillShowUpHere": "Start snapping, your photos will show up here",
"youPickWhatGetsBackedUp": "You pick what gets backed up",
"privateAndEndToEndEncryptedAlways": "Private and end-to-end encrypted, always",
"grantAccess": "Grant access",
diff --git a/mobile/apps/photos/lib/ui/collections/device/device_folders_vertical_grid_view.dart b/mobile/apps/photos/lib/ui/collections/device/device_folders_vertical_grid_view.dart
index 3ff43e3c38..c505f54225 100644
--- a/mobile/apps/photos/lib/ui/collections/device/device_folders_vertical_grid_view.dart
+++ b/mobile/apps/photos/lib/ui/collections/device/device_folders_vertical_grid_view.dart
@@ -17,7 +17,7 @@ import "package:photos/ui/collections/device/device_folder_list_item.dart";
import "package:photos/ui/collections/device/device_folder_row_item.dart";
import 'package:photos/ui/common/loading_widget.dart';
import 'package:photos/ui/components/searchable_appbar.dart';
-import "package:photos/ui/tabs/albums/empty_states/on_device_select_folders_empty_state.dart";
+import "package:photos/ui/tabs/albums/empty_states/on_device_empty_state.dart";
import 'package:photos/ui/viewer/gallery/empty_state.dart';
import "package:photos/utils/device_collection_sort_util.dart";
import "package:photos/utils/local_settings.dart";
@@ -165,7 +165,7 @@ class _DeviceFolderVerticalGridViewBodyState
if (backupPreferenceService.hasSkippedOnboardingPermission) {
return SliverFillRemaining(
hasScrollBody: false,
- child: OnDeviceSelectFoldersEmptyState(
+ child: OnDeviceEmptyState.permission(
onFoldersSelected: () {
_refreshDeviceCollections();
},
@@ -199,11 +199,18 @@ class _DeviceFolderVerticalGridViewBodyState
return widget.emptyStateSliver!;
}
return widget.showEmptyState
- ? const SliverFillRemaining(
- child: Padding(
- padding: EdgeInsets.all(22),
- child: EmptyState(),
- ),
+ ? SliverFillRemaining(
+ hasScrollBody: false,
+ child: widget.searchQuery.isEmpty
+ ? OnDeviceEmptyState.noFolders(
+ onFoldersSelected: _refreshDeviceCollections,
+ )
+ : Padding(
+ padding: const EdgeInsets.all(22),
+ child: EmptyState(
+ text: AppLocalizations.of(context).noResultsFound,
+ ),
+ ),
)
: const SliverToBoxAdapter(child: SizedBox.shrink());
}
diff --git a/mobile/apps/photos/lib/ui/components/banners/banner_action_button.dart b/mobile/apps/photos/lib/ui/components/banners/banner_action_button.dart
index d2a49470e1..e459ea9576 100644
--- a/mobile/apps/photos/lib/ui/components/banners/banner_action_button.dart
+++ b/mobile/apps/photos/lib/ui/components/banners/banner_action_button.dart
@@ -74,6 +74,7 @@ class BannerActionButton extends StatelessWidget {
return Stack(
clipBehavior: Clip.none,
+ fit: StackFit.passthrough,
children: [
Positioned(
top: -17,
diff --git a/mobile/apps/photos/lib/ui/social/feed_screen.dart b/mobile/apps/photos/lib/ui/social/feed_screen.dart
index 623a327e19..bb35c91fec 100644
--- a/mobile/apps/photos/lib/ui/social/feed_screen.dart
+++ b/mobile/apps/photos/lib/ui/social/feed_screen.dart
@@ -560,14 +560,12 @@ class _FeedScreenState extends State<FeedScreen> {
onTap: () => Navigator.of(context).pop(),
)
: null,
- title: _feedItems.isEmpty
- ? null
- : Text(
- AppLocalizations.of(context).feed,
- style: widget.showBackButton
- ? textTheme.bodyBold
- : TextStyles.h1Bold.copyWith(color: textTheme.h4Bold.color),
- ),
+ title: Text(
+ AppLocalizations.of(context).feed,
+ style: widget.showBackButton
+ ? TextStyles.bodyBold.copyWith(color: textTheme.bodyBold.color)
+ : TextStyles.h1Bold.copyWith(color: textTheme.h4Bold.color),
+ ),
),
body: _isLoading
? const Center(child: EnteLoadingWidget(size: 24))
diff --git a/mobile/apps/photos/lib/ui/social/widgets/feed_empty_state.dart b/mobile/apps/photos/lib/ui/social/widgets/feed_empty_state.dart
index e8696e0dab..7adcd1f782 100644
--- a/mobile/apps/photos/lib/ui/social/widgets/feed_empty_state.dart
+++ b/mobile/apps/photos/lib/ui/social/widgets/feed_empty_state.dart
@@ -1,10 +1,9 @@
+import "package:ente_components/ente_components.dart";
import "package:flutter/material.dart";
-import "package:hugeicons/hugeicons.dart";
import "package:photos/generated/l10n.dart";
-import "package:photos/theme/ente_theme.dart";
import "package:photos/ui/account/email_entry_page.dart";
import "package:photos/ui/collections/collection_action_sheet.dart";
-import "package:photos/ui/components/buttons/button_widget_v2.dart";
+import "package:photos/ui/components/banners/banner_action_button.dart";
import "package:photos/ui/tabs/albums/empty_states/empty_state_feature_row.dart";
class FeedEmptyState extends StatelessWidget {
@@ -12,115 +11,177 @@ class FeedEmptyState extends StatelessWidget {
final bool localGalleryMode;
+ static const _topPadding = 32.0;
+ static const _sectionSpacing = 48.0;
+ static const _contentWidth = 343.0;
+ static const _featureWidth = 300.0;
+ static const _assetHeight = 150.0;
+
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
+ final colors = context.componentColors;
final strings = AppLocalizations.of(context);
final bottomPadding = 64 + MediaQuery.paddingOf(context).bottom + 32;
+ final content = _content(context, strings);
- return Align(
- alignment: Alignment.bottomCenter,
- child: Padding(
- padding: EdgeInsets.fromLTRB(16, 32, 16, bottomPadding),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- ConstrainedBox(
- constraints: const BoxConstraints(maxWidth: 320),
- child: Column(
- children: [
- Text(
- localGalleryMode
- ? strings.seeWhatYourPeopleAreUpTo
- : strings.nothingHereYet,
- textAlign: TextAlign.center,
- style: textTheme.largeBold.copyWith(
- fontFamily: "Nunito",
- fontWeight: FontWeight.w800,
- fontSize: 18,
- height: 28 / 18,
- color: colorScheme.content,
+ return LayoutBuilder(
+ builder: (context, constraints) {
+ return SingleChildScrollView(
+ physics: const BouncingScrollPhysics(),
+ child: ConstrainedBox(
+ constraints: BoxConstraints(minHeight: constraints.maxHeight),
+ child: Align(
+ alignment: Alignment.bottomCenter,
+ child: Padding(
+ padding: EdgeInsets.fromLTRB(
+ 16,
+ _topPadding,
+ 16,
+ bottomPadding,
+ ),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ _FeedAssetSlot(assetPath: content.assetPath),
+ const SizedBox(height: _sectionSpacing),
+ SizedBox(
+ width: _contentWidth,
+ child: Column(
+ children: [
+ Text(
+ content.title,
+ textAlign: TextAlign.center,
+ style: TextStyle(
+ fontFamily: "Nunito",
+ fontWeight: FontWeight.w800,
+ fontSize: 24,
+ height: 28 / 24,
+ letterSpacing: 0,
+ color: colors.textBase,
+ ),
+ ),
+ const SizedBox(height: 24),
+ SizedBox(
+ width: _featureWidth,
+ child: Column(
+ children: [
+ EmptyStateBulletFeatureRow(
+ label: content.features[0],
+ ),
+ const SizedBox(height: 12),
+ EmptyStateBulletFeatureRow(
+ label: content.features[1],
+ ),
+ const SizedBox(height: 12),
+ EmptyStateBulletFeatureRow(
+ label: content.features[2],
+ ),
+ ],
+ ),
+ ),
+ ],
+ ),
+ ),
+ const SizedBox(height: _sectionSpacing),
+ SizedBox(
+ width: content.showTag ? _featureWidth : _contentWidth,
+ child: BannerActionButton(
+ label: content.buttonLabel,
+ variant: BannerActionButtonVariant.primary,
+ showTag: content.showTag,
+ onTap: content.onTap,
+ ),
),
- ),
- const SizedBox(height: 4),
- Text(
- localGalleryMode
- ? strings.signUpToShareMomentsPrivately
- : strings.shareAnAlbumWithSomeoneYouLove,
- textAlign: TextAlign.center,
- style: textTheme.miniMuted,
- ),
- ],
+ ],
+ ),
),
),
- const SizedBox(height: 32),
- ConstrainedBox(
- constraints: const BoxConstraints(maxWidth: 320),
- child: Column(
- children: localGalleryMode
- ? [
- EmptyStateFeatureRow(
- icon: HugeIcons.strokeRoundedFavourite,
- label: strings.reactToTheMomentsThatMatter,
- ),
- const SizedBox(height: 24),
- EmptyStateFeatureRow(
- icon: HugeIcons.strokeRoundedComment01,
- label: strings.leaveANoteOnTheMomentsSharedWithYou,
- ),
- const SizedBox(height: 24),
- EmptyStateFeatureRow(
- icon: HugeIcons.strokeRoundedLockSync01,
- label:
- strings.endToEndEncryptedOnlyYourPeopleCanSeeIt,
- ),
- ]
- : [
- EmptyStateFeatureRow(
- icon: HugeIcons.strokeRoundedFavourite,
- label: strings.seeTheLoveYourPhotosGet,
- ),
- const SizedBox(height: 24),
- EmptyStateFeatureRow(
- icon: HugeIcons.strokeRoundedComment01,
- label: strings.yourConversationsAttachedToTheMoment,
- ),
- const SizedBox(height: 24),
- EmptyStateFeatureRow(
- icon: HugeIcons.strokeRoundedUserMultiple,
- label: strings.stayConnectedWithThePeopleYouShareWith,
- ),
- ],
+ ),
+ );
+ },
+ );
+ }
+
+ _FeedEmptyStateContent _content(
+ BuildContext context,
+ AppLocalizations strings,
+ ) {
+ if (localGalleryMode) {
+ return _FeedEmptyStateContent(
+ assetPath: "assets/shared.png",
+ title: strings.albumsSharedEmptyTitle,
+ features: [
+ strings.albumsSharedEmptyFeatureShareLovedOnes,
+ strings.albumsSharedEmptyFeatureReactAndComment,
+ strings.albumsSharedEmptyFeaturePrivacy,
+ ],
+ buttonLabel: strings.getStarted,
+ showTag: true,
+ onTap: () {
+ Navigator.of(context).push(
+ MaterialPageRoute(
+ builder: (_) => const EmailEntryPage(
+ showReferralSourceField: false,
+ referralSource: "Offline",
),
),
- const SizedBox(height: 32),
- ButtonWidgetV2(
- buttonType: ButtonTypeV2.primary,
- labelText: localGalleryMode
- ? strings.getStarted
- : strings.shareAnAlbum,
- onTap: () async {
- if (localGalleryMode) {
- await Navigator.of(context).push(
- MaterialPageRoute(
- builder: (_) => const EmailEntryPage(
- showReferralSourceField: false,
- referralSource: "Offline",
- ),
- ),
- );
- return;
- }
- showCollectionActionSheet(
- context,
- actionType: CollectionActionType.shareCollection,
- );
- },
- ),
- ],
- ),
- ),
+ );
+ },
+ );
+ }
+
+ return _FeedEmptyStateContent(
+ assetPath: "assets/feed.png",
+ title: strings.albumsSharedEmptyTitle,
+ features: [
+ strings.albumsSharedEmptyFeatureShareLovedOnes,
+ strings.albumsSharedEmptyFeatureReactAndComment,
+ strings.albumsSharedEmptyFeaturePrivacy,
+ ],
+ buttonLabel: strings.shareAnAlbum,
+ onTap: () {
+ showCollectionActionSheet(
+ context,
+ actionType: CollectionActionType.shareCollection,
+ );
+ },
+ );
+ }
+}
+
+class _FeedEmptyStateContent {
+ const _FeedEmptyStateContent({
+ required this.assetPath,
+ required this.title,
+ required this.features,
+ required this.buttonLabel,
+ required this.onTap,
+ this.showTag = false,
+ });
+
+ final String? assetPath;
+ final String title;
+ final List<String> features;
+ final String buttonLabel;
+ final VoidCallback onTap;
+ final bool showTag;
+}
+
+class _FeedAssetSlot extends StatelessWidget {
+ const _FeedAssetSlot({required this.assetPath});
+
+ final String? assetPath;
+
+ @override
+ Widget build(BuildContext context) {
+ final path = assetPath;
+ if (path != null) {
+ return Image.asset(path);
+ }
+
+ return const SizedBox(
+ width: FeedEmptyState._contentWidth,
+ height: FeedEmptyState._assetHeight,
);
}
}
diff --git a/mobile/apps/photos/lib/ui/tabs/albums/empty_states/empty_state_feature_row.dart b/mobile/apps/photos/lib/ui/tabs/albums/empty_states/empty_state_feature_row.dart
index 13d046044a..8bf822d605 100644
--- a/mobile/apps/photos/lib/ui/tabs/albums/empty_states/empty_state_feature_row.dart
+++ b/mobile/apps/photos/lib/ui/tabs/albums/empty_states/empty_state_feature_row.dart
@@ -1,3 +1,4 @@
+import "package:ente_components/ente_components.dart";
import "package:flutter/widgets.dart";
import "package:hugeicons/hugeicons.dart";
import "package:photos/theme/ente_theme.dart";
@@ -33,3 +34,44 @@ class EmptyStateFeatureRow extends StatelessWidget {
);
}
}
+
+class EmptyStateBulletFeatureRow extends StatelessWidget {
+ const EmptyStateBulletFeatureRow({
+ required this.label,
+ super.key,
+ });
+
+ final String label;
+
+ @override
+ Widget build(BuildContext context) {
+ final colors = context.componentColors;
+
+ return Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ SizedBox(
+ width: 5,
+ height: 20,
+ child: Align(
+ alignment: Alignment.center,
+ child: DecoratedBox(
+ decoration: BoxDecoration(
+ color: colors.primary,
+ shape: BoxShape.circle,
+ ),
+ child: const SizedBox.square(dimension: 4),
+ ),
+ ),
+ ),
+ const SizedBox(width: 12),
+ Expanded(
+ child: Text(
+ label,
+ style: TextStyles.body.copyWith(color: colors.textLight),
+ ),
+ ),
+ ],
+ );
+ }
+}
diff --git a/mobile/apps/photos/lib/ui/tabs/albums/empty_states/on_device_empty_state.dart b/mobile/apps/photos/lib/ui/tabs/albums/empty_states/on_device_empty_state.dart
new file mode 100644
index 0000000000..ce19065b1d
--- /dev/null
+++ b/mobile/apps/photos/lib/ui/tabs/albums/empty_states/on_device_empty_state.dart
@@ -0,0 +1,170 @@
+import "package:ente_components/ente_components.dart";
+import "package:flutter/material.dart";
+import "package:photos/generated/l10n.dart";
+import "package:photos/ui/common/backup_flow_helper.dart";
+import "package:photos/ui/tabs/albums/empty_states/empty_state_feature_row.dart";
+
+class OnDeviceEmptyState extends StatelessWidget {
+ const OnDeviceEmptyState.permission({
+ this.onFoldersSelected,
+ super.key,
+ }) : _mode = _OnDeviceEmptyStateMode.permission;
+
+ const OnDeviceEmptyState.noFolders({
+ this.onFoldersSelected,
+ super.key,
+ }) : _mode = _OnDeviceEmptyStateMode.noFolders;
+
+ static const _permissionTopPadding = 12.0;
+ static const _permissionSectionSpacing = 48.0;
+
+ static const _contentWidth = 343.0;
+ static const _featureWidth = 300.0;
+
+ final _OnDeviceEmptyStateMode _mode;
+ final VoidCallback? onFoldersSelected;
+
+ @override
+ Widget build(BuildContext context) {
+ if (_mode == _OnDeviceEmptyStateMode.permission) {
+ return _buildPermissionState(context);
+ }
+ return _buildNoFoldersState(context);
+ }
+
+ Widget _buildPermissionState(BuildContext context) {
+ final colors = context.componentColors;
+ final strings = AppLocalizations.of(context);
+ final bottomPadding = 64 + MediaQuery.paddingOf(context).bottom + 32;
+ final features = [
+ strings.albumsOnDevicePermissionFeatureAllowAccessFaceRecognition,
+ strings.albumsOnDevicePermissionFeatureLocalProcessing,
+ strings.albumsOnDevicePermissionFeatureControlUploads,
+ ];
+
+ return LayoutBuilder(
+ builder: (context, constraints) {
+ return SingleChildScrollView(
+ physics: const BouncingScrollPhysics(),
+ child: ConstrainedBox(
+ constraints: BoxConstraints(minHeight: constraints.maxHeight),
+ child: Align(
+ alignment: Alignment.bottomCenter,
+ child: Padding(
+ padding: EdgeInsets.fromLTRB(
+ 16,
+ _permissionTopPadding,
+ 16,
+ bottomPadding,
+ ),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ SizedBox(
+ width: _contentWidth,
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Image.asset(
+ "assets/on_device.png",
+ ),
+ const SizedBox(height: _permissionSectionSpacing),
+ Text(
+ strings.allowAccessToYourPhotos,
+ textAlign: TextAlign.center,
+ style: TextStyle(
+ fontFamily: "Nunito",
+ fontWeight: FontWeight.w800,
+ fontSize: 24,
+ height: 28 / 24,
+ letterSpacing: 0,
+ color: colors.textBase,
+ ),
+ ),
+ const SizedBox(height: 24),
+ SizedBox(
+ width: _featureWidth,
+ child: Column(
+ children: [
+ EmptyStateBulletFeatureRow(
+ label: features[0],
+ ),
+ const SizedBox(height: 12),
+ EmptyStateBulletFeatureRow(
+ label: features[1],
+ ),
+ const SizedBox(height: 12),
+ EmptyStateBulletFeatureRow(
+ label: features[2],
+ ),
+ ],
+ ),
+ ),
+ ],
+ ),
+ ),
+ const SizedBox(height: _permissionSectionSpacing),
+ ButtonComponent(
+ label: strings.albumsOnDevicePermissionCta,
+ shouldSurfaceExecutionStates: false,
+ onTap: () => _selectFolders(context),
+ ),
+ ],
+ ),
+ ),
+ ),
+ ),
+ );
+ },
+ );
+ }
+
+ Widget _buildNoFoldersState(BuildContext context) {
+ final colors = context.componentColors;
+ final strings = AppLocalizations.of(context);
+
+ return Center(
+ child: SizedBox(
+ width: _contentWidth,
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ SizedBox(
+ width: _contentWidth,
+ child: Text(
+ strings.noAlbumsOnThisDevice,
+ textAlign: TextAlign.center,
+ style: TextStyle(
+ fontFamily: "Nunito",
+ fontWeight: FontWeight.w800,
+ fontSize: 24,
+ height: 28 / 24,
+ letterSpacing: 0,
+ color: colors.textBase,
+ ),
+ ),
+ ),
+ const SizedBox(height: 8),
+ Text(
+ strings.startSnappingYourPhotosWillShowUpHere,
+ textAlign: TextAlign.center,
+ style: TextStyles.mini.copyWith(
+ color: colors.textLight,
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+
+ Future<void> _selectFolders(BuildContext context) async {
+ await handleFolderSelectionBackupFlow(context);
+ onFoldersSelected?.call();
+ }
+}
+
+enum _OnDeviceEmptyStateMode {
+ permission,
+ noFolders,
+}
diff --git a/mobile/apps/photos/lib/ui/tabs/albums/empty_states/on_device_select_folders_empty_state.dart b/mobile/apps/photos/lib/ui/tabs/albums/empty_states/on_device_select_folders_empty_state.dart
deleted file mode 100644
index 6883f8d567..0000000000
--- a/mobile/apps/photos/lib/ui/tabs/albums/empty_states/on_device_select_folders_empty_state.dart
+++ /dev/null
@@ -1,91 +0,0 @@
-import "package:flutter/material.dart";
-import "package:hugeicons/hugeicons.dart";
-import "package:photos/generated/l10n.dart";
-import "package:photos/theme/ente_theme.dart";
-import "package:photos/ui/common/backup_flow_helper.dart";
-import "package:photos/ui/components/buttons/button_widget_v2.dart";
-import "package:photos/ui/tabs/albums/empty_states/empty_state_feature_row.dart";
-
-class OnDeviceSelectFoldersEmptyState extends StatelessWidget {
- const OnDeviceSelectFoldersEmptyState({this.onFoldersSelected, super.key});
-
- final VoidCallback? onFoldersSelected;
-
- @override
- Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
- final strings = AppLocalizations.of(context);
- final bottomPadding = 64 + MediaQuery.paddingOf(context).bottom + 32;
-
- return Align(
- alignment: Alignment.bottomCenter,
- child: Padding(
- padding: EdgeInsets.fromLTRB(16, 32, 16, bottomPadding),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- ConstrainedBox(
- constraints: const BoxConstraints(maxWidth: 320),
- child: Column(
- children: [
- Text(
- strings.allowAccessToYourPhotos,
- textAlign: TextAlign.center,
- style: textTheme.largeBold.copyWith(
- fontFamily: "Nunito",
- fontWeight: FontWeight.w800,
- fontSize: 18,
- height: 28 / 18,
- color: colorScheme.content,
- ),
- ),
- const SizedBox(height: 4),
- Text(
- strings.enteNeedsPermissionToSeeDeviceAlbums,
- textAlign: TextAlign.center,
- style: textTheme.miniMuted,
- ),
- ],
- ),
- ),
- const SizedBox(height: 32),
- ConstrainedBox(
- constraints: const BoxConstraints(maxWidth: 320),
- child: Column(
- children: [
- EmptyStateFeatureRow(
- icon: HugeIcons.strokeRoundedFolder02,
- label: strings.allYourDeviceAlbumsInOnePlace,
- ),
- const SizedBox(height: 24),
- EmptyStateFeatureRow(
- icon: HugeIcons.strokeRoundedCloudSavingDone01,
- label: strings.youPickWhatGetsBackedUp,
- ),
- const SizedBox(height: 24),
- EmptyStateFeatureRow(
- icon: HugeIcons.strokeRoundedLockSync01,
- label: strings.privateAndEndToEndEncryptedAlways,
- ),
- ],
- ),
- ),
- const SizedBox(height: 32),
- ButtonWidgetV2(
- buttonType: ButtonTypeV2.primary,
- labelText: strings.selectFolders,
- onTap: () => _selectFolders(context),
- shouldSurfaceExecutionStates: false,
- ),
- ],
- ),
- ),
- );
- }
-
- Future<void> _selectFolders(BuildContext context) async {
- await handleFolderSelectionBackupFlow(context);
- onFoldersSelected?.call();
- }
-}
diff --git a/mobile/apps/photos/lib/ui/tabs/albums/empty_states/on_ente_empty_state.dart b/mobile/apps/photos/lib/ui/tabs/albums/empty_states/on_ente_empty_state.dart
index 8e215b8bc0..9a3ed9eafb 100644
--- a/mobile/apps/photos/lib/ui/tabs/albums/empty_states/on_ente_empty_state.dart
+++ b/mobile/apps/photos/lib/ui/tabs/albums/empty_states/on_ente_empty_state.dart
@@ -1,142 +1,95 @@
-import "package:ente_pure_utils/ente_pure_utils.dart";
+import "package:ente_components/ente_components.dart";
import "package:flutter/material.dart";
-import "package:hugeicons/hugeicons.dart";
import "package:photos/generated/l10n.dart";
-import "package:photos/models/collection/collection.dart";
-import "package:photos/models/collection/collection_items.dart";
-import "package:photos/services/collections_service.dart";
-import "package:photos/theme/ente_theme.dart";
-import "package:photos/ui/collections/album/smart_album_people.dart";
-import "package:photos/ui/components/buttons/button_widget_v2.dart";
+import "package:photos/ui/common/backup_flow_helper.dart";
import "package:photos/ui/tabs/albums/empty_states/empty_state_feature_row.dart";
-import "package:photos/ui/viewer/gallery/collection_page.dart";
-import "package:photos/utils/dialog_util.dart";
class OnEnteEmptyState extends StatelessWidget {
const OnEnteEmptyState({super.key});
+ static const _topPadding = 32.0;
+ static const _sectionSpacing = 48.0;
+ static const _contentWidth = 343.0;
+ static const _featureWidth = 300.0;
+
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
+ final colors = context.componentColors;
final strings = AppLocalizations.of(context);
final bottomPadding = 64 + MediaQuery.paddingOf(context).bottom + 32;
+ final features = [
+ strings.albumsOnEnteEmptyFeatureAccessAnyDevice,
+ strings.albumsOnEnteEmptyFeatureShareLovedOnes,
+ strings.albumsOnEnteEmptyFeaturePrivacy,
+ ];
- return Align(
- alignment: Alignment.bottomCenter,
- child: Padding(
- padding: EdgeInsets.fromLTRB(16, 32, 16, bottomPadding),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- ConstrainedBox(
- constraints: const BoxConstraints(maxWidth: 320),
- child: Column(
- children: [
- Text(
- strings.organizeYourMemories,
- textAlign: TextAlign.center,
- style: textTheme.largeBold.copyWith(
- fontFamily: "Nunito",
- fontWeight: FontWeight.w800,
- fontSize: 18,
- height: 28 / 18,
- color: colorScheme.content,
+ return LayoutBuilder(
+ builder: (context, constraints) {
+ return SingleChildScrollView(
+ physics: const BouncingScrollPhysics(),
+ child: ConstrainedBox(
+ constraints: BoxConstraints(minHeight: constraints.maxHeight),
+ child: Align(
+ alignment: Alignment.bottomCenter,
+ child: Padding(
+ padding: EdgeInsets.fromLTRB(
+ 16,
+ _topPadding,
+ 16,
+ bottomPadding,
+ ),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Image.asset("assets/on_ente.png"),
+ const SizedBox(height: _sectionSpacing),
+ SizedBox(
+ width: _contentWidth,
+ child: Column(
+ children: [
+ Text(
+ strings.albumsOnEnteEmptyTitle,
+ textAlign: TextAlign.center,
+ style: TextStyle(
+ fontFamily: "Nunito",
+ fontWeight: FontWeight.w800,
+ fontSize: 24,
+ height: 28 / 24,
+ letterSpacing: 0,
+ color: colors.textBase,
+ ),
+ ),
+ const SizedBox(height: 24),
+ SizedBox(
+ width: _featureWidth,
+ child: Column(
+ children: [
+ EmptyStateBulletFeatureRow(label: features[0]),
+ const SizedBox(height: 12),
+ EmptyStateBulletFeatureRow(label: features[1]),
+ const SizedBox(height: 12),
+ EmptyStateBulletFeatureRow(label: features[2]),
+ ],
+ ),
+ ),
+ ],
+ ),
),
- ),
- const SizedBox(height: 4),
- Text(
- strings.groupPhotosTheWayYouThinkAboutThem,
- textAlign: TextAlign.center,
- style: textTheme.miniMuted,
- ),
- ],
- ),
- ),
- const SizedBox(height: 32),
- ConstrainedBox(
- constraints: const BoxConstraints(maxWidth: 320),
- child: Column(
- children: [
- EmptyStateFeatureRow(
- icon: HugeIcons.strokeRoundedLockSync01,
- label: strings.endToEndEncryptedOnlyYourPeopleCanSeeIt,
- ),
- const SizedBox(height: 24),
- EmptyStateFeatureRow(
- icon: HugeIcons.strokeRoundedCloudSavingDone01,
- label: strings.backedUpSafelyAcrossDevices,
- ),
- const SizedBox(height: 24),
- EmptyStateFeatureRow(
- icon: HugeIcons.strokeRoundedSparkles,
- label: strings.smartAlbumsOrganizePhotosForYou,
- ),
- ],
+ const SizedBox(height: _sectionSpacing),
+ ButtonComponent(
+ label: strings.albumsOnEnteEmptyCta,
+ shouldSurfaceExecutionStates: false,
+ onTap: () async {
+ await handleFolderSelectionBackupFlow(context);
+ },
+ ),
+ ],
+ ),
),
),
- const SizedBox(height: 32),
- ButtonWidgetV2(
- buttonType: ButtonTypeV2.primary,
- labelText: strings.createAlbum,
- onTap: () => _createAlbum(context),
- shouldSurfaceExecutionStates: false,
- ),
- const SizedBox(height: 8),
- ButtonWidgetV2(
- buttonType: ButtonTypeV2.secondary,
- labelText: strings.createASmartAlbum,
- onTap: () => _createSmartAlbum(context),
- shouldSurfaceExecutionStates: false,
- ),
- ],
- ),
- ),
- );
- }
-
- Future<Collection?> _showCreateAlbumDialog(BuildContext context) async {
- Collection? collection;
- final result = await showTextInputDialog(
- context,
- title: AppLocalizations.of(context).newAlbum,
- submitButtonLabel: AppLocalizations.of(context).create,
- hintText: AppLocalizations.of(context).enterAlbumName,
- alwaysShowSuccessState: false,
- initialValue: "",
- textCapitalization: TextCapitalization.words,
- popnavAfterSubmission: true,
- onSubmit: (String text) async {
- final albumName = text.trim();
- if (albumName.isEmpty) {
- return;
- }
- collection = await CollectionsService.instance.createAlbum(albumName);
+ ),
+ );
},
);
-
- if (result is Exception && context.mounted) {
- await showGenericErrorDialog(context: context, error: result);
- }
- return collection;
- }
-
- Future<void> _createAlbum(BuildContext context) async {
- final collection = await _showCreateAlbumDialog(context);
- if (collection == null || !context.mounted) {
- return;
- }
- await routeToPage(
- context,
- CollectionPage(CollectionWithThumbnail(collection, null)),
- );
- }
-
- Future<void> _createSmartAlbum(BuildContext context) async {
- final collection = await _showCreateAlbumDialog(context);
- if (collection == null || !context.mounted) {
- return;
- }
- await routeToPage(context, SmartAlbumPeople(collectionId: collection.id));
}
}
diff --git a/mobile/apps/photos/lib/ui/tabs/albums/empty_states/shared_empty_state.dart b/mobile/apps/photos/lib/ui/tabs/albums/empty_states/shared_empty_state.dart
index 1aa6feb0e1..bced6ddb3d 100644
--- a/mobile/apps/photos/lib/ui/tabs/albums/empty_states/shared_empty_state.dart
+++ b/mobile/apps/photos/lib/ui/tabs/albums/empty_states/shared_empty_state.dart
@@ -1,106 +1,100 @@
+import "package:ente_components/ente_components.dart";
import "package:flutter/material.dart";
-import "package:hugeicons/hugeicons.dart";
import "package:photos/generated/l10n.dart";
-import "package:photos/service_locator.dart";
-import "package:photos/services/account/user_service.dart";
-import "package:photos/theme/ente_theme.dart";
-import "package:photos/ui/components/buttons/button_widget_v2.dart";
+import "package:photos/ui/collections/collection_action_sheet.dart";
import "package:photos/ui/tabs/albums/empty_states/empty_state_feature_row.dart";
-import "package:photos/utils/dialog_util.dart";
class SharedEmptyState extends StatelessWidget {
const SharedEmptyState({super.key});
+ static const _topPadding = 32.0;
+ static const _sectionSpacing = 48.0;
+ static const _contentToButtonSpacing = 56.0;
+ static const _contentWidth = 343.0;
+ static const _featureWidth = 300.0;
+
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
+ final colors = context.componentColors;
final strings = AppLocalizations.of(context);
final bottomPadding = 64 + MediaQuery.paddingOf(context).bottom + 32;
+ final features = [
+ strings.albumsSharedEmptyFeatureShareLovedOnes,
+ strings.albumsSharedEmptyFeatureReactAndComment,
+ strings.albumsSharedEmptyFeaturePrivacy,
+ ];
- return Align(
- alignment: Alignment.bottomCenter,
- child: Padding(
- padding: EdgeInsets.fromLTRB(16, 32, 16, bottomPadding),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- ConstrainedBox(
- constraints: const BoxConstraints(maxWidth: 320),
- child: Column(
- children: [
- Text(
- strings.albumsSharedWithYouShowUpHere,
- textAlign: TextAlign.center,
- style: textTheme.largeBold.copyWith(
- fontFamily: "Nunito",
- fontWeight: FontWeight.w800,
- fontSize: 18,
- height: 28 / 18,
- color: colorScheme.content,
+ return LayoutBuilder(
+ builder: (context, constraints) {
+ return SingleChildScrollView(
+ physics: const BouncingScrollPhysics(),
+ child: ConstrainedBox(
+ constraints: BoxConstraints(minHeight: constraints.maxHeight),
+ child: Align(
+ alignment: Alignment.bottomCenter,
+ child: Padding(
+ padding: EdgeInsets.fromLTRB(
+ 16,
+ _topPadding,
+ 16,
+ bottomPadding,
+ ),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ SizedBox(
+ width: _contentWidth,
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Image.asset("assets/shared.png", fit: BoxFit.contain),
+ const SizedBox(height: _sectionSpacing),
+ Text(
+ strings.albumsSharedEmptyTitle,
+ textAlign: TextAlign.center,
+ style: TextStyle(
+ fontFamily: "Nunito",
+ fontWeight: FontWeight.w800,
+ fontSize: 24,
+ height: 28 / 24,
+ letterSpacing: 0,
+ color: colors.textBase,
+ ),
+ ),
+ const SizedBox(height: 24),
+ SizedBox(
+ width: _featureWidth,
+ child: Column(
+ children: [
+ EmptyStateBulletFeatureRow(label: features[0]),
+ const SizedBox(height: 12),
+ EmptyStateBulletFeatureRow(label: features[1]),
+ const SizedBox(height: 12),
+ EmptyStateBulletFeatureRow(label: features[2]),
+ ],
+ ),
+ ),
+ ],
+ ),
),
- ),
- const SizedBox(height: 4),
- Text(
- strings.inviteFamilyToSharePhotosPrivately,
- textAlign: TextAlign.center,
- style: textTheme.miniMuted,
- ),
- ],
- ),
- ),
- const SizedBox(height: 32),
- ConstrainedBox(
- constraints: const BoxConstraints(maxWidth: 320),
- child: Column(
- children: [
- EmptyStateFeatureRow(
- icon: HugeIcons.strokeRoundedUserMultiple,
- label: strings.shareStorageWithUpToFiveFamilyMembers,
- ),
- const SizedBox(height: 24),
- EmptyStateFeatureRow(
- icon: HugeIcons.strokeRoundedLock,
- label: strings.privateSpaceForEveryMember,
- ),
- const SizedBox(height: 24),
- EmptyStateFeatureRow(
- icon: HugeIcons.strokeRoundedFavourite,
- label: strings.reactAndChatOnSharedMemories,
- ),
- ],
+ const SizedBox(height: _contentToButtonSpacing),
+ ButtonComponent(
+ label: strings.shareAnAlbum,
+ shouldSurfaceExecutionStates: false,
+ onTap: () async {
+ showCollectionActionSheet(
+ context,
+ actionType: CollectionActionType.shareCollection,
+ );
+ },
+ ),
+ ],
+ ),
),
),
- const SizedBox(height: 32),
- ButtonWidgetV2(
- buttonType: ButtonTypeV2.primary,
- labelText: strings.addFamily,
- onTap: () => _addFamily(context),
- shouldSurfaceExecutionStates: false,
- ),
- ],
- ),
- ),
+ ),
+ );
+ },
);
}
-
- Future<void> _addFamily(BuildContext context) async {
- try {
- final userDetails = await UserService.instance.getUserDetailsV2(
- memoryCount: false,
- );
- if (!context.mounted) {
- return;
- }
- await billingService.launchFamilyPortal(
- context,
- userDetails,
- refreshOnOpen: false,
- );
- } catch (e) {
- if (context.mounted) {
- await showGenericErrorDialog(context: context, error: e);
- }
- }
- }
}
diff --git a/mobile/apps/photos/lib/ui/tabs/albums_tab.dart b/mobile/apps/photos/lib/ui/tabs/albums_tab.dart
index 0d30c7487c..c8f03d311d 100644
--- a/mobile/apps/photos/lib/ui/tabs/albums_tab.dart
+++ b/mobile/apps/photos/lib/ui/tabs/albums_tab.dart
@@ -822,7 +822,7 @@ class _AlbumsTabState extends State<AlbumsTab>
duration: _kSearchTransitionDuration,
switchInCurve: Curves.easeOutCubic,
switchOutCurve: Curves.easeInCubic,
- child: _isSearchActive
+ child: _isSearchActive || localGalleryMode
? const SizedBox.shrink(key: ValueKey("hidden_filters"))
: Padding(
key: const ValueKey("album_filters"),