π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Refactor FeedScreen to use FeedEmptyState widget for improved empty state handling
AmanRajSinghMouryaab88e4d12990
diff --git a/mobile/apps/photos/lib/ui/social/feed_screen.dart b/mobile/apps/photos/lib/ui/social/feed_screen.dartindex d37b6917aa..d3264af260 100644--- a/mobile/apps/photos/lib/ui/social/feed_screen.dart+++ b/mobile/apps/photos/lib/ui/social/feed_screen.dart@@ -13,6 +13,7 @@ import "package:photos/models/file/file.dart";import "package:photos/models/social/feed_data_provider.dart";import "package:photos/models/social/feed_item.dart";import "package:photos/models/social/social_data_provider.dart";+import "package:photos/service_locator.dart";import "package:photos/services/collections_service.dart";import 'package:photos/services/social_notification_coordinator.dart';import "package:photos/theme/ente_theme.dart";@@ -20,6 +21,7 @@ import "package:photos/ui/common/loading_widget.dart";import "package:photos/ui/components/buttons/icon_button_widget.dart";import "package:photos/ui/social/comments_screen.dart";import "package:photos/ui/social/social_actor_contact_navigation.dart";+import "package:photos/ui/social/widgets/feed_empty_state.dart";import "package:photos/ui/social/widgets/feed_item_widget.dart";import "package:photos/ui/viewer/file/detail_page.dart";import "package:photos/ui/viewer/gallery/collection_page.dart";@@ -562,15 +564,22 @@ class _FeedScreenState extends State<FeedScreen> {onTap: () => Navigator.of(context).pop(),): null,- title: Text(- AppLocalizations.of(context).feed,- style: widget.showBackButton ? textTheme.bodyBold : textTheme.h4Bold,- ),+ title: _feedItems.isEmpty+ ? null+ : Text(+ AppLocalizations.of(context).feed,+ style: widget.showBackButton+ ? textTheme.bodyBold+ : textTheme.h4Bold,+ ),),body: _isLoading? const Center(child: EnteLoadingWidget(size: 24)): _feedItems.isEmpty- ? _buildEmptyState(context)+ ? FeedEmptyState(+ offlineUiMode: isOfflineMode &&+ !Configuration.instance.hasConfiguredAccount(),+ ): RefreshIndicator(onRefresh: _onRefresh,child: ListView.builder(@@ -649,35 +658,6 @@ class _FeedScreenState extends State<FeedScreen> {);}- Widget _buildEmptyState(BuildContext context) {- final colorScheme = getEnteColorScheme(context);- final textTheme = getEnteTextTheme(context);-- return Center(- child: Padding(- padding: const EdgeInsets.all(32),- child: Column(- mainAxisAlignment: MainAxisAlignment.center,- children: [- Icon(- Icons.notifications_none_outlined,- size: 48,- color: colorScheme.strokeMuted,- ),- const SizedBox(height: 16),- Text(- AppLocalizations.of(context).noActivityYet,- style: textTheme.body.copyWith(- color: colorScheme.textMuted,- ),- textAlign: TextAlign.center,- ),- ],- ),- ),- );- }-String _feedItemStableKey(FeedItem item) {return '${item.type}_${item.fileID}_${item.commentID}_${item.createdAt}';}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.dartnew file mode 100644index 0000000000..0df4622755--- /dev/null+++ b/mobile/apps/photos/lib/ui/social/widgets/feed_empty_state.dart@@ -0,0 +1,128 @@+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/tabs/albums/empty_states/empty_state_feature_row.dart";++class FeedEmptyState extends StatelessWidget {+ const FeedEmptyState({+ required this.offlineUiMode,+ super.key,+ });++ final bool offlineUiMode;++ @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(+ offlineUiMode+ ? strings.seeWhatYourPeopleAreUpTo+ : strings.nothingHereYet,+ 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(+ offlineUiMode+ ? strings.signUpToShareMomentsPrivately+ : strings.shareAnAlbumWithSomeoneYouLove,+ textAlign: TextAlign.center,+ style: textTheme.miniMuted,+ ),+ ],+ ),+ ),+ const SizedBox(height: 32),+ ConstrainedBox(+ constraints: const BoxConstraints(maxWidth: 320),+ child: Column(+ children: offlineUiMode+ ? [+ 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,+ ),+ ],+ ),+ ),+ const SizedBox(height: 32),+ ButtonWidgetV2(+ buttonType: ButtonTypeV2.primary,+ labelText:+ offlineUiMode ? strings.getStarted : strings.shareAnAlbum,+ onTap: () async {+ if (offlineUiMode) {+ await Navigator.of(context).push(+ MaterialPageRoute(+ builder: (_) => const EmailEntryPage(+ showReferralSourceField: false,+ referralSource: "Offline",+ ),+ ),+ );+ return;+ }+ showCollectionActionSheet(+ context,+ actionType: CollectionActionType.shareCollection,+ );+ },+ ),+ ],+ ),+ ),+ );+ }+}