π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Remove stale albums and feed widgets
AmanRajSinghMourya1a5164bd7478
diff --git a/mobile/apps/photos/lib/ui/collections/button/archived_button.dart b/mobile/apps/photos/lib/ui/collections/button/archived_button.dartdeleted file mode 100644index a03588d167..0000000000--- a/mobile/apps/photos/lib/ui/collections/button/archived_button.dart+++ /dev/null@@ -1,102 +0,0 @@-import 'package:ente_pure_utils/ente_pure_utils.dart';-import 'package:flutter/material.dart';-import 'package:photos/core/configuration.dart';-import 'package:photos/db/files_db.dart';-import "package:photos/generated/l10n.dart";-import "package:photos/models/metadata/common_keys.dart";-import "package:photos/services/collections_service.dart";-import 'package:photos/ui/viewer/gallery/archive_page.dart';--class ArchivedCollectionsButton extends StatelessWidget {- final TextStyle textStyle;-- const ArchivedCollectionsButton(this.textStyle, {super.key});-- @override- Widget build(BuildContext context) {- final Set<int> hiddenCollectionId = CollectionsService.instance- .getHiddenCollectionIds();- return OutlinedButton(- style: OutlinedButton.styleFrom(- backgroundColor: Theme.of(context).colorScheme.surface,- shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),- padding: const EdgeInsets.all(0),- side: BorderSide(- width: 0.5,- color: Theme.of(context).iconTheme.color!.withValues(alpha: 0.24),- ),- ),- child: SizedBox(- height: 48,- width: double.infinity,- child: Padding(- padding: const EdgeInsets.symmetric(horizontal: 16),- child: Row(- mainAxisAlignment: MainAxisAlignment.spaceBetween,- children: [- Row(- children: [- Icon(- Icons.archive_outlined,- color: Theme.of(context).iconTheme.color,- ),- const Padding(padding: EdgeInsets.all(6)),- FutureBuilder<int>(- future: FilesDB.instance.archivedFilesCount(- archiveVisibility,- Configuration.instance.getUserID()!,- hiddenCollectionId,- ),- builder: (context, snapshot) {- if (snapshot.hasData && snapshot.data! > 0) {- return RichText(- text: TextSpan(- style: textStyle,- children: [- TextSpan(- text: AppLocalizations.of(- context,- ).archiveCollectionName,- style: Theme.of(context).textTheme.titleMedium,- ),- const TextSpan(text: " \u2022 "),- TextSpan(text: snapshot.data.toString()),- //need to query in db and bring this value- ],- ),- );- } else {- return RichText(- text: TextSpan(- style: textStyle,- children: [- TextSpan(- text: AppLocalizations.of(- context,- ).archiveCollectionName,- style: Theme.of(context).textTheme.titleMedium,- ),- //need to query in db and bring this value- ],- ),- );- }- },- ),- ],- ),- Icon(- Icons.chevron_right,- color: Theme.of(context).iconTheme.color,- ),- ],- ),- ),- ),- onPressed: () async {- // ignore: unawaited_futures- routeToPage(context, ArchivePage());- },- );- }-}diff --git a/mobile/apps/photos/lib/ui/collections/button/hidden_button.dart b/mobile/apps/photos/lib/ui/collections/button/hidden_button.dartdeleted file mode 100644index 576b7f194d..0000000000--- a/mobile/apps/photos/lib/ui/collections/button/hidden_button.dart+++ /dev/null@@ -1,82 +0,0 @@-import 'package:ente_pure_utils/ente_pure_utils.dart';-import 'package:flutter/material.dart';-import "package:photos/generated/l10n.dart";-import 'package:photos/services/local_authentication_service.dart';-import 'package:photos/ui/viewer/gallery/hidden_page.dart';--class HiddenCollectionsButtonWidget extends StatelessWidget {- final TextStyle textStyle;-- const HiddenCollectionsButtonWidget(this.textStyle, {super.key});-- @override- Widget build(BuildContext context) {- return OutlinedButton(- style: OutlinedButton.styleFrom(- backgroundColor: Theme.of(context).colorScheme.surface,- shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),- padding: const EdgeInsets.all(0),- side: BorderSide(- width: 0.5,- color: Theme.of(context).iconTheme.color!.withValues(alpha: 0.24),- ),- ),- child: SizedBox(- height: 48,- width: double.infinity,- child: Padding(- padding: const EdgeInsets.symmetric(horizontal: 16),- child: Row(- mainAxisAlignment: MainAxisAlignment.spaceBetween,- children: [- Row(- children: [- Icon(- Icons.visibility_off,- color: Theme.of(context).iconTheme.color,- ),- const Padding(padding: EdgeInsets.all(6)),- RichText(- text: TextSpan(- style: textStyle,- children: [- TextSpan(- text: AppLocalizations.of(context).hidden,- style: Theme.of(context).textTheme.titleMedium,- ),- const TextSpan(text: " \u2022 "),- WidgetSpan(- child: Icon(- Icons.lock_outline,- size: 16,- color: Theme.of(context).iconTheme.color,- ),- ),- //need to query in db and bring this value- ],- ),- ),- ],- ),- Icon(- Icons.chevron_right,- color: Theme.of(context).iconTheme.color,- ),- ],- ),- ),- ),- onPressed: () async {- final hasAuthenticated = await LocalAuthenticationService.instance- .requestLocalAuthentication(- context,- AppLocalizations.of(context).authToViewYourHiddenFiles,- );- if (hasAuthenticated) {- // ignore: unawaited_futures- routeToPage(context, const HiddenPage());- }- },- );- }-}diff --git a/mobile/apps/photos/lib/ui/collections/button/trash_button.dart b/mobile/apps/photos/lib/ui/collections/button/trash_button.dartdeleted file mode 100644index 4d02dfe2b3..0000000000--- a/mobile/apps/photos/lib/ui/collections/button/trash_button.dart+++ /dev/null@@ -1,123 +0,0 @@-import 'dart:async';--import 'package:ente_pure_utils/ente_pure_utils.dart';-import 'package:flutter/material.dart';-import 'package:photos/core/event_bus.dart';-import 'package:photos/db/trash_db.dart';-import 'package:photos/events/trash_updated_event.dart';-import "package:photos/generated/l10n.dart";-import "package:photos/services/local_authentication_service.dart";-import 'package:photos/ui/viewer/gallery/trash_page.dart';--class TrashSectionButton extends StatefulWidget {- const TrashSectionButton(this.textStyle, {super.key});-- final TextStyle textStyle;-- @override- State<TrashSectionButton> createState() => _TrashSectionButtonState();-}--class _TrashSectionButtonState extends State<TrashSectionButton> {- late StreamSubscription<TrashUpdatedEvent> _trashUpdatedEventSubscription;-- @override- void initState() {- super.initState();- _trashUpdatedEventSubscription = Bus.instance- .on<TrashUpdatedEvent>()- .listen((event) {- if (mounted) {- setState(() {});- }- });- }-- @override- void dispose() {- _trashUpdatedEventSubscription.cancel();- super.dispose();- }-- @override- Widget build(BuildContext context) {- return OutlinedButton(- style: OutlinedButton.styleFrom(- backgroundColor: Theme.of(context).colorScheme.surface,- shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),- padding: const EdgeInsets.all(0),- side: BorderSide(- width: 0.5,- color: Theme.of(context).iconTheme.color!.withValues(alpha: 0.24),- ),- ),- child: SizedBox(- height: 48,- width: double.infinity,- child: Padding(- padding: const EdgeInsets.symmetric(horizontal: 16),- child: Row(- mainAxisAlignment: MainAxisAlignment.spaceBetween,- children: [- Row(- children: [- Icon(Icons.delete, color: Theme.of(context).iconTheme.color),- const Padding(padding: EdgeInsets.all(6)),- FutureBuilder<int>(- future: TrashDB.instance.count(),- builder: (context, snapshot) {- if (snapshot.hasData && snapshot.data! > 0) {- return RichText(- text: TextSpan(- style: widget.textStyle,- children: [- TextSpan(- text: AppLocalizations.of(context).trash,- style: Theme.of(context).textTheme.titleMedium,- ),- const TextSpan(text: " \u2022 "),- TextSpan(text: snapshot.data.toString()),- //need to query in db and bring this value- ],- ),- );- } else {- return RichText(- text: TextSpan(- style: widget.textStyle,- children: [- TextSpan(- text: AppLocalizations.of(context).trash,- style: Theme.of(context).textTheme.titleMedium,- ),- //need to query in db and bring this value- ],- ),- );- }- },- ),- ],- ),- Icon(- Icons.chevron_right,- color: Theme.of(context).iconTheme.color,- ),- ],- ),- ),- ),- onPressed: () async {- final hasAuthenticated = await LocalAuthenticationService.instance- .requestLocalAuthentication(- context,- AppLocalizations.of(context).authToViewTrashedFiles,- );- if (hasAuthenticated) {- // ignore: unawaited_futures- routeToPage(context, TrashPage());- }- },- );- }-}diff --git a/mobile/apps/photos/lib/ui/collections/button/uncategorized_button.dart b/mobile/apps/photos/lib/ui/collections/button/uncategorized_button.dartdeleted file mode 100644index a7d8ee8609..0000000000--- a/mobile/apps/photos/lib/ui/collections/button/uncategorized_button.dart+++ /dev/null@@ -1,107 +0,0 @@-import 'package:collection/collection.dart';-import 'package:ente_pure_utils/ente_pure_utils.dart';-import 'package:flutter/material.dart';-import "package:photos/generated/l10n.dart";-import 'package:photos/models/collection/collection.dart';-import 'package:photos/services/collections_service.dart';-import 'package:photos/services/hidden_service.dart';-import 'package:photos/ui/viewer/gallery/uncategorized_page.dart';--class UnCategorizedCollections extends StatelessWidget {- final TextStyle textStyle;-- const UnCategorizedCollections(this.textStyle, {super.key});-- @override- Widget build(BuildContext context) {- final Collection? collection = CollectionsService.instance- .getActiveCollections()- .firstWhereOrNull((e) => e.type == CollectionType.uncategorized);- if (collection == null) {- // create uncategorized collection if it's not already created- CollectionsService.instance.getUncategorizedCollection().ignore();- }- return OutlinedButton(- style: OutlinedButton.styleFrom(- backgroundColor: Theme.of(context).colorScheme.surface,- shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),- padding: const EdgeInsets.all(0),- side: BorderSide(- width: 0.5,- color: Theme.of(context).iconTheme.color!.withValues(alpha: 0.24),- ),- ),- child: SizedBox(- height: 48,- width: double.infinity,- child: Padding(- padding: const EdgeInsets.symmetric(horizontal: 16),- child: Row(- mainAxisAlignment: MainAxisAlignment.spaceBetween,- children: [- Row(- children: [- Icon(- Icons.category_outlined,- color: Theme.of(context).iconTheme.color,- ),- const Padding(padding: EdgeInsets.all(6)),- FutureBuilder<int>(- future: collection == null- ? Future.value(0)- : CollectionsService.instance.getFileCount(collection),- builder: (context, snapshot) {- if (snapshot.hasData && snapshot.data! > 0) {- return RichText(- text: TextSpan(- style: textStyle,- children: [- TextSpan(- text: AppLocalizations.of(- context,- ).uncategorized,- style: Theme.of(context).textTheme.titleMedium,- ),- const TextSpan(text: " \u2022 "),- TextSpan(text: snapshot.data.toString()),- //need to query in db and bring this value- ],- ),- );- } else {- return RichText(- text: TextSpan(- style: textStyle,- children: [- TextSpan(- text: AppLocalizations.of(- context,- ).uncategorized,- style: Theme.of(context).textTheme.titleMedium,- ),- //need to query in db and bring this value- ],- ),- );- }- },- ),- ],- ),- Icon(- Icons.chevron_right,- color: Theme.of(context).iconTheme.color,- ),- ],- ),- ),- ),- onPressed: () async {- if (collection != null) {- // ignore: unawaited_futures- routeToPage(context, UnCategorizedPage(collection));- }- },- );- }-}diff --git a/mobile/apps/photos/lib/ui/collections/device/device_folders_grid_view.dart b/mobile/apps/photos/lib/ui/collections/device/device_folders_grid_view.dartdeleted file mode 100644index 6a0f67df39..0000000000--- a/mobile/apps/photos/lib/ui/collections/device/device_folders_grid_view.dart+++ /dev/null@@ -1,198 +0,0 @@-import 'dart:async';-import "dart:math";--import "package:ente_components/ente_components.dart";-import "package:ente_pure_utils/ente_pure_utils.dart";-import 'package:flutter/material.dart';-import 'package:logging/logging.dart';-import 'package:photos/core/event_bus.dart';-import 'package:photos/db/device_files_db.dart';-import 'package:photos/db/files_db.dart';-import 'package:photos/events/backup_folders_updated_event.dart';-import 'package:photos/events/local_photos_updated_event.dart';-import "package:photos/generated/l10n.dart";-import 'package:photos/models/device_collection.dart';-import "package:photos/service_locator.dart";-import "package:photos/theme/ente_theme.dart";-import "package:photos/ui/collections/device/device_folder_row_item.dart";-import "package:photos/ui/common/backup_flow_helper.dart";-import 'package:photos/ui/common/loading_widget.dart';-import 'package:photos/ui/viewer/gallery/empty_state.dart';-import "package:styled_text/styled_text.dart";--class DeviceFoldersGridView extends StatefulWidget {- const DeviceFoldersGridView({super.key});-- @override- State<DeviceFoldersGridView> createState() => _DeviceFoldersGridViewState();-}--class _DeviceFoldersGridViewState extends State<DeviceFoldersGridView> {- StreamSubscription<BackupFoldersUpdatedEvent>? _backupFoldersUpdatedEvent;- StreamSubscription<LocalPhotosUpdatedEvent>? _localFilesSubscription;- String _loadReason = "init";- final _logger = Logger((_DeviceFoldersGridViewState).toString());- final _debouncer = Debouncer(- const Duration(seconds: 2),- executionInterval: const Duration(seconds: 5),- leading: true,- );- static const maxThumbnailWidth = 224.0;- static const horizontalPadding = 16.0;- static const crossAxisSpacing = 8.0;- static const _thumbnailToTextSpacing = 8.0;- static const _titleToSubtitleSpacing = 2.0;-- @override- void initState() {- super.initState();- _backupFoldersUpdatedEvent = Bus.instance- .on<BackupFoldersUpdatedEvent>()- .listen((event) {- _loadReason = event.reason;- if (mounted) {- setState(() {});- }- });- _localFilesSubscription = Bus.instance.on<LocalPhotosUpdatedEvent>().listen(- (event) {- _debouncer.run(() async {- if (mounted) {- _loadReason = event.reason;- setState(() {});- }- });- },- );- }-- @override- Widget build(BuildContext context) {- final double screenWidth = MediaQuery.sizeOf(context).width;- final int albumsCountInCrossAxis = max(screenWidth ~/ maxThumbnailWidth, 3);-- final double totalCrossAxisSpacing =- (albumsCountInCrossAxis - 1) * crossAxisSpacing;- final double sideOfThumbnail =- (screenWidth - totalCrossAxisSpacing - horizontalPadding) /- albumsCountInCrossAxis;- final double gridItemTextHeight = _gridItemTextHeight(context);-- debugPrint("${(DeviceFoldersGridView).toString()} - $_loadReason");-- // Check permission status- final hasSkippedPermission =- backupPreferenceService.hasSkippedOnboardingPermission;-- // If permission was skipped, show add folders prompt- if (hasSkippedPermission) {- return _buildAddFoldersState(context);- }-- return SizedBox(- height: sideOfThumbnail + gridItemTextHeight,- child: Align(- alignment: Alignment.centerLeft,- child: FutureBuilder<List<DeviceCollection>>(- future: FilesDB.instance.getDeviceCollections(- includeCoverThumbnail: true,- ),- builder: (context, snapshot) {- if (snapshot.hasData) {- return snapshot.data!.isEmpty- ? const Padding(- padding: EdgeInsets.all(22),- child: EmptyState(),- )- : Padding(- padding: const EdgeInsets.symmetric(- horizontal: horizontalPadding / 2,- ),- child: ListView.builder(- scrollDirection: Axis.horizontal,- physics: const ScrollPhysics(),- // to disable GridView's scrolling- itemBuilder: (context, index) {- final deviceCollection = snapshot.data![index];- return Padding(- padding: const EdgeInsets.only(- right: horizontalPadding / 2,- ),- child: DeviceFolderRowItem(- deviceCollection,- sideOfThumbnail: sideOfThumbnail,- ),- );- },- itemCount: snapshot.data!.length,- ),- );- } else if (snapshot.hasError) {- _logger.severe("failed to load device gallery", snapshot.error);- return Text(AppLocalizations.of(context).failedToLoadAlbums);- } else {- return const EnteLoadingWidget();- }- },- ),- ),- );- }-- Widget _buildAddFoldersState(BuildContext context) {- final textTheme = getEnteTextTheme(context);- const selectFoldersGreen = Color(0xFF08C225);-- return Center(- child: Padding(- padding: const EdgeInsets.symmetric(vertical: 16),- child: Column(- mainAxisSize: MainAxisSize.min,- children: [- Image.asset("assets/ducky_folders.png", width: 138, height: 120),- const SizedBox(height: 16),- Padding(- padding: const EdgeInsets.symmetric(horizontal: 10),- child: StyledText(- text: AppLocalizations.of(context).selectFoldersToBackup,- style: textTheme.smallMuted,- textAlign: TextAlign.center,- tags: {- 'action': StyledTextActionTag(- (String? text, Map<String?, String?> attrs) async {- await handleFolderSelectionBackupFlow(context);- if (mounted) setState(() {});- },- style: textTheme.small.copyWith(color: selectFoldersGreen),- ),- },- ),- ),- ],- ),- ),- );- }-- double _gridItemTextHeight(BuildContext context) {- final textScaler = MediaQuery.textScalerOf(context);- return (_thumbnailToTextSpacing +- _scaledLineHeight(textScaler, TextStyles.body) +- _titleToSubtitleSpacing +- _scaledLineHeight(textScaler, TextStyles.mini))- .ceilToDouble();- }-- double _scaledLineHeight(TextScaler textScaler, TextStyle style) {- final fontSize = style.fontSize ?? 14;- return textScaler.scale(fontSize) * (style.height ?? 1);- }-- @override- void dispose() {- _backupFoldersUpdatedEvent?.cancel();- _localFilesSubscription?.cancel();- _debouncer.cancelDebounceTimer();- super.dispose();- }-}diff --git a/mobile/apps/photos/lib/ui/components/banners/shared_empty_offline_state_widget.dart b/mobile/apps/photos/lib/ui/components/banners/shared_empty_offline_state_widget.dartdeleted file mode 100644index 55f1da1739..0000000000--- a/mobile/apps/photos/lib/ui/components/banners/shared_empty_offline_state_widget.dart+++ /dev/null@@ -1,68 +0,0 @@-import "package:flutter/material.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/components/banners/banner_action_button.dart";--class SharedEmptyOfflineStateWidget extends StatelessWidget {- const SharedEmptyOfflineStateWidget({super.key});-- @override- Widget build(BuildContext context) {- final colorScheme = getEnteColorScheme(context);- final textTheme = getEnteTextTheme(context);- final l10n = AppLocalizations.of(context);-- return Center(- child: Padding(- padding: const EdgeInsets.symmetric(horizontal: 36),- child: Column(- mainAxisAlignment: MainAxisAlignment.center,- children: [- Image.asset(- "assets/ducky_share.png",- height: 180,- errorBuilder: (context, error, stackTrace) {- return const SizedBox(height: 180);- },- ),- Text(- l10n.offlineEnableSharingTitle,- style: textTheme.largeBold.copyWith(- fontFamily: "Nunito",- fontWeight: FontWeight.w800,- fontSize: 20,- height: 24 / 18,- letterSpacing: -1,- color: colorScheme.content,- ),- ),- const SizedBox(height: 12),- Text(- l10n.offlineEnableSharingDesc,- textAlign: TextAlign.center,- style: textTheme.smallMuted,- ),- const SizedBox(height: 28),- BannerActionButton(- label: l10n.getStarted,- showTag: true,- stickTagToLightTheme: false,- variant: BannerActionButtonVariant.primary,- onTap: () async {- await Navigator.of(context).push(- MaterialPageRoute(- builder: (_) => const EmailEntryPage(- showReferralSourceField: false,- referralSource: "Offline",- ),- ),- );- },- ),- ],- ),- ),- );- }-}diff --git a/mobile/apps/photos/lib/ui/offline/empty/on_ente_empty_state.dart b/mobile/apps/photos/lib/ui/offline/empty/on_ente_empty_state.dartdeleted file mode 100644index 98bc70e2f1..0000000000--- a/mobile/apps/photos/lib/ui/offline/empty/on_ente_empty_state.dart+++ /dev/null@@ -1,77 +0,0 @@-import "package:flutter/material.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/components/banners/banner_action_button.dart";--class EmptyOnEnteSection extends StatelessWidget {- const EmptyOnEnteSection({super.key});-- @override- Widget build(BuildContext context) {- final colorScheme = getEnteColorScheme(context);- final textTheme = getEnteTextTheme(context);- final l10n = AppLocalizations.of(context);- final titleStyle = textTheme.largeBold.copyWith(- fontFamily: "Nunito",- fontWeight: FontWeight.w800,- fontSize: 20,- height: 24 / 18,- letterSpacing: -1,- color: colorScheme.content,- );-- return Padding(- padding: const EdgeInsets.all(12),- child: Container(- width: double.infinity,- padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 24),- decoration: BoxDecoration(- color: colorScheme.fillDark,- borderRadius: BorderRadius.circular(20),- ),- child: Column(- mainAxisSize: MainAxisSize.min,- children: [- SizedBox(- height: 140,- child: Image.asset(- "assets/photo_backup.png",- fit: BoxFit.contain,- ),- ),- const SizedBox(height: 14),- Text(- l10n.offlineEnableBackupTitle,- textAlign: TextAlign.center,- style: titleStyle,- ),- const SizedBox(height: 8),- Text(- l10n.offlineEnableBackupDesc,- textAlign: TextAlign.center,- style: textTheme.smallMuted,- ),- const SizedBox(height: 28),- BannerActionButton(- label: l10n.getStarted,- stickTagToLightTheme: false,- showTag: true,- variant: BannerActionButtonVariant.primary,- onTap: () async {- await Navigator.of(context).push(- MaterialPageRoute(- builder: (_) => const EmailEntryPage(- showReferralSourceField: false,- referralSource: "Offline",- ),- ),- );- },- ),- ],- ),- ),- );- }-}diff --git a/mobile/apps/photos/lib/ui/social/widgets/feed_preview_item_widget.dart b/mobile/apps/photos/lib/ui/social/widgets/feed_preview_item_widget.dartdeleted file mode 100644index 0221120abb..0000000000--- a/mobile/apps/photos/lib/ui/social/widgets/feed_preview_item_widget.dart+++ /dev/null@@ -1,402 +0,0 @@-import "package:flutter/material.dart";-import "package:hugeicons/hugeicons.dart";-import "package:photos/generated/l10n.dart";-import "package:photos/models/api/collection/user.dart";-import "package:photos/models/social/feed_item.dart";-import "package:photos/services/collections_service.dart";-import "package:photos/theme/colors.dart";-import "package:photos/theme/ente_theme.dart";-import "package:photos/theme/text_style.dart";-import "package:photos/ui/sharing/user_avator_widget.dart";-import "package:photos/ui/social/widgets/resolved_social_user_name.dart";--class FeedPreviewItemWidget extends StatelessWidget {- final FeedItem feedItem;- final int currentUserID;- final Map<String, String> anonDisplayNames;- final VoidCallback? onTap;-- const FeedPreviewItemWidget({- required this.feedItem,- required this.currentUserID,- this.anonDisplayNames = const {},- this.onTap,- super.key,- });-- @override- Widget build(BuildContext context) {- final colorScheme = getEnteColorScheme(context);- final textTheme = getEnteTextTheme(context);-- return GestureDetector(- onTap: onTap,- behavior: HitTestBehavior.opaque,- child: Row(- children: [- // Overlapping avatars with icon badge- _PreviewAvatarStack(- feedItem: feedItem,- currentUserID: currentUserID,- anonDisplayNames: anonDisplayNames,- ),- const SizedBox(width: 16),- // Text content- Expanded(- child: _PreviewTextContent(- feedItem: feedItem,- currentUserID: currentUserID,- anonDisplayNames: anonDisplayNames,- textTheme: textTheme,- colorScheme: colorScheme,- ),- ),- const SizedBox(width: 8),- // Trailing chevron- Icon(Icons.chevron_right, color: colorScheme.strokeMuted, size: 24),- ],- ),- );- }-}--/// Displays overlapping avatars with feed type icon badge.-class _PreviewAvatarStack extends StatelessWidget {- final FeedItem feedItem;- final int currentUserID;- final Map<String, String> anonDisplayNames;-- static const double _avatarSize = 44.0;- static const double _iconSize = 27.0;- static const double _overlap = 12.0;-- const _PreviewAvatarStack({- required this.feedItem,- required this.currentUserID,- required this.anonDisplayNames,- });-- @override- Widget build(BuildContext context) {- final actors = _getActors();- final hasMultipleActors = actors.length > 1;- final colorScheme = getEnteColorScheme(context);-- // Calculate total width needed- final totalWidth = hasMultipleActors ? _avatarSize + _overlap : _avatarSize;- final totalHeight = hasMultipleActors- ? _avatarSize + _overlap- : _avatarSize;-- return SizedBox(- width: totalWidth,- height: totalHeight,- child: Stack(- clipBehavior: Clip.none,- children: [- // First (top-left) avatar- Positioned(- left: 0,- top: 0,- child: _buildAvatar(actors.first, colorScheme, showBorder: false),- ),- // Second (bottom-right) avatar - only if multiple actors- if (hasMultipleActors)- Positioned(- right: 0,- bottom: 0,- child: _buildAvatar(actors[1], colorScheme, showBorder: true),- ),- // Icon badge at bottom-left- Positioned(- left: -3,- bottom: hasMultipleActors ? _overlap - 5 : -3,- child: _FeedTypeIconBadge(- size: _iconSize,- colorScheme: colorScheme,- ),- ),- ],- ),- );- }-- Widget _buildAvatar(- User user,- EnteColorScheme colorScheme, {- required bool showBorder,- }) {- return Container(- decoration: BoxDecoration(- shape: BoxShape.circle,- border: showBorder- ? Border.all(color: colorScheme.backgroundColour, width: 1.5)- : null,- ),- child: SizedBox(- width: _avatarSize,- height: _avatarSize,- child: ClipOval(- child: UserAvatarWidget(- user,- type: AvatarType.large,- currentUserID: currentUserID,- addStroke: false,- ),- ),- ),- );- }-- List<User> _getActors() {- final users = <User>[];- final maxActors = feedItem.actorCount.clamp(1, 2);-- for (int i = 0; i < maxActors; i++) {- final userID = feedItem.actorUserIDs[i];- final anonID = feedItem.actorAnonIDs[i];-- if (userID <= 0 && anonID != null) {- final displayName = anonDisplayNames[anonID] ?? anonID;- users.add(- User(id: userID, email: "[email protected]", name: displayName),- );- } else {- final user = CollectionsService.instance.getFileOwner(- userID,- feedItem.collectionID,- );- users.add(user);- }- }-- return users;- }-}--/// Notification icon badge for feed entry point.-class _FeedTypeIconBadge extends StatelessWidget {- final double size;- final EnteColorScheme colorScheme;-- const _FeedTypeIconBadge({required this.size, required this.colorScheme});-- @override- Widget build(BuildContext context) {- return Container(- width: size,- height: size,- decoration: BoxDecoration(- color: colorScheme.backgroundElevated,- shape: BoxShape.circle,- border: Border.all(color: colorScheme.strokeMuted, width: 1),- boxShadow: [- BoxShadow(- color: Colors.black.withValues(alpha: 0.1),- blurRadius: 4,- offset: const Offset(0, 1),- ),- ],- ),- child: Center(- child: Transform.rotate(- angle: -0.08,- child: HugeIcon(- // Icons.notifications_outlined,- icon: HugeIcons.strokeRoundedNotification01,- size: 14,- color: colorScheme.textBase,- ),- ),- ),- );- }-}--/// Text content for feed preview.-class _PreviewTextContent extends StatelessWidget {- final FeedItem feedItem;- final int currentUserID;- final Map<String, String> anonDisplayNames;- final EnteTextTheme textTheme;- final EnteColorScheme colorScheme;-- const _PreviewTextContent({- required this.feedItem,- required this.currentUserID,- required this.anonDisplayNames,- required this.textTheme,- required this.colorScheme,- });-- @override- Widget build(BuildContext context) {- final primaryUser = _getPrimaryUser();- return ResolvedSocialUserName(- user: primaryUser,- builder: (context, primaryName) => Column(- crossAxisAlignment: CrossAxisAlignment.start,- mainAxisSize: MainAxisSize.min,- children: [- _buildUsernameRow(context, primaryName),- const SizedBox(height: 2),- Text.rich(- _getActionDescriptionSpan(- context,- textTheme.small.copyWith(- color: colorScheme.textMuted,- fontWeight: FontWeight.w500,- ),- ),- maxLines: 1,- overflow: TextOverflow.ellipsis,- ),- ],- ),- );- }-- Widget _buildUsernameRow(BuildContext context, String primaryName) {- if (!feedItem.hasMultipleActors) {- return Text(- primaryName,- style: textTheme.small.copyWith(- fontWeight: FontWeight.w600,- color: colorScheme.textBase,- ),- maxLines: 1,- overflow: TextOverflow.ellipsis,- );- }-- final othersCount = feedItem.additionalActorCount;- final othersText = othersCount == 1- ? AppLocalizations.of(context).and1Other- : AppLocalizations.of(context).andXOthers(count: othersCount);-- return Text.rich(- TextSpan(- children: [- TextSpan(- text: primaryName,- style: textTheme.small.copyWith(- fontWeight: FontWeight.w600,- color: colorScheme.textBase,- ),- ),- TextSpan(- text: " $othersText",- style: textTheme.small.copyWith(- fontWeight: FontWeight.w500,- color: colorScheme.textMuted,- ),- ),- ],- ),- maxLines: 1,- overflow: TextOverflow.ellipsis,- );- }-- InlineSpan _getActionDescriptionSpan(- BuildContext context,- TextStyle baseStyle,- ) {- final l10n = AppLocalizations.of(context);- final isOwn = feedItem.isOwnedByCurrentUser;- switch (feedItem.type) {- case FeedItemType.photoLike:- return TextSpan(- text: feedItem.isVideo- ? (isOwn ? l10n.likedYourVideo : l10n.likedAVideo)- : (isOwn ? l10n.likedYourPhoto : l10n.likedAPhoto),- style: baseStyle,- );- case FeedItemType.comment:- return TextSpan(- text: feedItem.isVideo- ? (isOwn ? l10n.commentedOnYourVideo : l10n.commentedOnAVideo)- : (isOwn ? l10n.commentedOnYourPhoto : l10n.commentedOnAPhoto),- style: baseStyle,- );- case FeedItemType.reply:- return TextSpan(- text: isOwn ? l10n.repliedToYourComment : l10n.repliedToAComment,- style: baseStyle,- );- case FeedItemType.commentLike:- return TextSpan(- text: isOwn ? l10n.likedYourComment : l10n.likedAComment,- style: baseStyle,- );- case FeedItemType.replyLike:- return TextSpan(- text: isOwn ? l10n.likedYourReply : l10n.likedAReply,- style: baseStyle,- );- case FeedItemType.sharedPhoto:- final count = feedItem.sharedFileCount;- final albumName = feedItem.collectionName ?? l10n.albums;- final fullText = count == 1- ? l10n.addedAMemoryTo(albumName: albumName)- : l10n.addedNMemoriesTo(count: count, albumName: albumName);- return _buildAlbumNameHighlightedSpan(- fullText: fullText,- albumName: albumName,- baseStyle: baseStyle,- );- case FeedItemType.sharedCollection:- final albumName = feedItem.collectionName ?? l10n.albums;- return _buildAlbumNameHighlightedSpan(- fullText: l10n.sharedAlbumWithYou(albumName: albumName),- albumName: albumName,- baseStyle: baseStyle,- );- }- }-- InlineSpan _buildAlbumNameHighlightedSpan({- required String fullText,- required String albumName,- required TextStyle baseStyle,- }) {- if (albumName.isEmpty) {- return TextSpan(text: fullText, style: baseStyle);- }-- final startIndex = fullText.indexOf(albumName);- if (startIndex < 0) {- return TextSpan(text: fullText, style: baseStyle);- }-- final beforeText = fullText.substring(0, startIndex);- final afterText = fullText.substring(startIndex + albumName.length);-- return TextSpan(- style: baseStyle,- children: [- if (beforeText.isNotEmpty) TextSpan(text: beforeText),- TextSpan(- text: albumName,- style: baseStyle.copyWith(fontWeight: FontWeight.w700),- ),- if (afterText.isNotEmpty) TextSpan(text: afterText),- ],- );- }-- User _getPrimaryUser() {- final userID = feedItem.primaryActorUserID;- final anonID = feedItem.primaryActorAnonID;-- if (userID <= 0 && anonID != null) {- final displayName = anonDisplayNames[anonID] ?? anonID;- return User(id: userID, email: "[email protected]", name: displayName);- }-- return CollectionsService.instance.getFileOwner(- userID,- feedItem.collectionID,- );- }-}diff --git a/mobile/apps/photos/lib/ui/social/widgets/feed_preview_widget.dart b/mobile/apps/photos/lib/ui/social/widgets/feed_preview_widget.dartdeleted file mode 100644index b0180518aa..0000000000--- a/mobile/apps/photos/lib/ui/social/widgets/feed_preview_widget.dart+++ /dev/null@@ -1,134 +0,0 @@-import "dart:async";--import "package:ente_pure_utils/ente_pure_utils.dart";-import "package:flutter/material.dart";-import "package:photos/core/configuration.dart";-import "package:photos/core/event_bus.dart";-import "package:photos/events/people_changed_event.dart";-import "package:photos/events/social_data_updated_event.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/theme/ente_theme.dart";-import "package:photos/ui/social/feed_screen.dart";-import "package:photos/ui/social/widgets/feed_preview_item_widget.dart";--/// Widget that displays a preview of the latest feed item.-///-/// Shown in the Sharing tab to provide quick access to the activity feed.-class FeedPreviewWidget extends StatefulWidget {- const FeedPreviewWidget({super.key});-- @override- State<FeedPreviewWidget> createState() => _FeedPreviewWidgetState();-}--class _FeedPreviewWidgetState extends State<FeedPreviewWidget> {- FeedItem? _latestItem;- bool _isLoading = true;- late final int _currentUserID;- Map<String, String> _anonDisplayNames = {};-- late final StreamSubscription<SocialDataUpdatedEvent> _socialDataSubscription;- late final StreamSubscription<PeopleChangedEvent> _peopleChangedSubscription;- final _refreshDebouncer = Debouncer(const Duration(milliseconds: 500));-- @override- void initState() {- super.initState();- _currentUserID = Configuration.instance.getUserID() ?? 0;- _loadLatestItem();-- // Listen for social data updates (comments/reactions synced)- _socialDataSubscription = Bus.instance.on<SocialDataUpdatedEvent>().listen((- event,- ) {- _refreshDebouncer.run(() => _loadLatestItem());- });-- // Listen for people changes (user names updated)- _peopleChangedSubscription = Bus.instance.on<PeopleChangedEvent>().listen((- event,- ) {- // Refresh if a person was saved/edited and matches the current actor- if (event.type == PeopleEventType.saveOrEditPerson &&- _latestItem != null) {- final personUserID = event.person?.data.userID;- if (personUserID != null &&- _latestItem!.actorUserIDs.contains(personUserID)) {- _refreshDebouncer.run(() => _loadLatestItem());- }- }- });- }-- @override- void dispose() {- _socialDataSubscription.cancel();- _peopleChangedSubscription.cancel();- super.dispose();- }-- Future<void> _loadLatestItem() async {- final item = await FeedDataProvider.instance.getLatestFeedItem();-- // Load anon display names if there's an item- Map<String, String> anonNames = {};- if (item != null) {- anonNames = await SocialDataProvider.instance- .getAnonDisplayNamesForCollection(item.collectionID);- }-- if (mounted) {- setState(() {- _latestItem = item;- _anonDisplayNames = anonNames;- _isLoading = false;- });- }- }-- void _onTap() {- routeToPage(context, const FeedScreen());- }-- @override- Widget build(BuildContext context) {- if (_isLoading) {- return const SizedBox.shrink();- }-- if (_latestItem == null) {- return const SizedBox.shrink();- }-- final colorScheme = getEnteColorScheme(context);-- return Padding(- padding: const EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 8),- child: Container(- decoration: BoxDecoration(- color: colorScheme.backgroundElevated2,- borderRadius: BorderRadius.circular(20),- border: Border.all(color: colorScheme.strokeFainter, width: 1),- ),- child: Material(- color: Colors.transparent,- child: InkWell(- onTap: _onTap,- borderRadius: BorderRadius.circular(20),- child: Padding(- padding: const EdgeInsets.symmetric(horizontal: 18, vertical: 14),- child: FeedPreviewItemWidget(- feedItem: _latestItem!,- currentUserID: _currentUserID,- anonDisplayNames: _anonDisplayNames,- onTap: _onTap,- ),- ),- ),- ),- ),- );- }-}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.dartindex b70dc97db7..c336d911ca 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,39 +1,5 @@import "package:ente_components/ente_components.dart";import "package:flutter/widgets.dart";-import "package:hugeicons/hugeicons.dart";-import "package:photos/theme/ente_theme.dart";--class EmptyStateFeatureRow extends StatelessWidget {- const EmptyStateFeatureRow({- required this.icon,- required this.label,- super.key,- });-- final List<List<dynamic>> icon;- final String label;-- @override- Widget build(BuildContext context) {- final textTheme = getEnteTextTheme(context);-- return Row(- crossAxisAlignment: CrossAxisAlignment.center,- children: [- Padding(- padding: const EdgeInsets.all(6),- child: HugeIcon(- icon: icon,- size: 20,- color: const Color.fromRGBO(222, 222, 222, 1),- ),- ),- const SizedBox(width: 8),- Expanded(child: Text(label, style: textTheme.small)),- ],- );- }-}class EmptyStateBulletFeatureRow extends StatelessWidget {const EmptyStateBulletFeatureRow({required this.label, super.key});diff --git a/mobile/apps/photos/lib/ui/tabs/shared/empty_state.dart b/mobile/apps/photos/lib/ui/tabs/shared/empty_state.dartdeleted file mode 100644index 613d1ae92d..0000000000--- a/mobile/apps/photos/lib/ui/tabs/shared/empty_state.dart+++ /dev/null@@ -1,210 +0,0 @@-import "package:flutter/material.dart";-import "package:photos/core/event_bus.dart";-import "package:photos/events/tab_changed_event.dart";-import "package:photos/generated/l10n.dart";-import "package:photos/theme/ente_theme.dart";-import 'package:photos/ui/collections/collection_action_sheet.dart';-import 'package:photos/ui/components/buttons/button_widget.dart';-import "package:photos/ui/components/empty_state_item_widget.dart";-import "package:photos/ui/components/models/button_type.dart";-import "package:photos/ui/notification/toast.dart";-import "package:photos/utils/collection_util.dart";-import "package:photos/utils/share_util.dart";--class SharedEmptyStateWidget extends StatelessWidget {- const SharedEmptyStateWidget({super.key});-- @override- Widget build(BuildContext context) {- final textTheme = getEnteTextTheme(context);- return SingleChildScrollView(- child: Padding(- padding: const EdgeInsets.fromLTRB(16, 12, 16, 114),- child: Padding(- padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 10),- child: Column(- mainAxisSize: MainAxisSize.min,- mainAxisAlignment: MainAxisAlignment.center,- children: [- Padding(- padding: const EdgeInsets.symmetric(- horizontal: 4,- vertical: 16,- ),- child: Column(- mainAxisSize: MainAxisSize.min,- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Text(- AppLocalizations.of(context).privateSharing,- style: textTheme.h3Bold,- textAlign: TextAlign.start,- ),- const SizedBox(height: 24),- Column(- mainAxisSize: MainAxisSize.min,- children: [- EmptyStateItemWidget(- AppLocalizations.of(- context,- ).shareOnlyWithThePeopleYouWant,- ),- const SizedBox(height: 12),- EmptyStateItemWidget(- AppLocalizations.of(- context,- ).usePublicLinksForPeopleNotOnEnte,- ),- const SizedBox(height: 12),- EmptyStateItemWidget(- AppLocalizations.of(context).allowPeopleToAddPhotos,- ),- ],- ),- ],- ),- ),- const SizedBox(height: 16),- Padding(- padding: const EdgeInsets.symmetric(vertical: 4),- child: Column(- mainAxisSize: MainAxisSize.min,- children: [- ButtonWidget(- buttonType: ButtonType.trailingIconPrimary,- labelText: AppLocalizations.of(context).shareAnAlbumNow,- icon: Icons.arrow_forward_outlined,- onTap: () async {- showCollectionActionSheet(- context,- actionType: CollectionActionType.shareCollection,- );- },- ),- const SizedBox(height: 6),- ButtonWidget(- buttonType: ButtonType.trailingIconSecondary,- labelText: AppLocalizations.of(- context,- ).collectEventPhotos,- icon: Icons.add_photo_alternate_outlined,- onTap: () async {- await onTapCollectEventPhotos(context);- },- ),- const SizedBox(height: 6),- ButtonWidget(- buttonType: ButtonType.trailingIconSecondary,- labelText: AppLocalizations.of(context).inviteYourFriends,- icon: Icons.ios_share_outlined,- onTap: () async {- // ignore: unawaited_futures- shareText(- AppLocalizations.of(- context,- ).shareTextRecommendUsingEnte,- );- },- ),- ],- ),- ),- ],- ),- ),- ),- );- }-}--class OutgoingAlbumEmptyState extends StatelessWidget {- const OutgoingAlbumEmptyState({super.key});-- @override- Widget build(BuildContext context) {- return Column(- mainAxisSize: MainAxisSize.min,- children: [- Padding(- padding: const EdgeInsets.symmetric(vertical: 24),- child: Column(- mainAxisSize: MainAxisSize.min,- children: [- Icon(- Icons.collections_outlined,- color: getEnteColorScheme(context).strokeMuted,- ),- const SizedBox(height: 12),- Text(- AppLocalizations.of(context).noAlbumsSharedByYouYet,- style: getEnteTextTheme(context).bodyMuted,- ),- ],- ),- ),- const SizedBox(height: 12),- Padding(- padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 24),- child: ButtonWidget(- buttonType: ButtonType.trailingIconPrimary,- labelText: AppLocalizations.of(context).shareYourFirstAlbum,- icon: Icons.add,- onTap: () async {- showToast(context, AppLocalizations.of(context).shareAlbumHint);- Bus.instance.fire(- TabChangedEvent(1, TabChangedEventSource.collectionsPage),- );- },- ),- ),- const SizedBox(height: 12),- ],- );- }-}--class IncomingAlbumEmptyState extends StatelessWidget {- const IncomingAlbumEmptyState({super.key});-- @override- Widget build(BuildContext context) {- return Column(- mainAxisSize: MainAxisSize.min,- children: [- Padding(- padding: const EdgeInsets.symmetric(vertical: 24),- child: Column(- mainAxisSize: MainAxisSize.min,- children: [- Icon(- Icons.collections_outlined,- color: getEnteColorScheme(context).strokeMuted,- ),- const SizedBox(height: 12),- Text(- AppLocalizations.of(context).nothingSharedWithYouYet,- style: getEnteTextTheme(context).bodyMuted,- ),- ],- ),- ),- const SizedBox(height: 12),- Padding(- padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 24),- child: ButtonWidget(- buttonType: ButtonType.trailingIconPrimary,- labelText: AppLocalizations.of(context).inviteYourFriends,- icon: Icons.ios_share_outlined,- onTap: () async {- // ignore: unawaited_futures- shareText(- AppLocalizations.of(context).shareTextRecommendUsingEnte,- );- },- ),- ),- const SizedBox(height: 12),- ],- );- }-}diff --git a/mobile/apps/photos/lib/ui/tabs/shared_collections_tab.dart b/mobile/apps/photos/lib/ui/tabs/shared_collections_tab.dartdeleted file mode 100644index 0739679f90..0000000000--- a/mobile/apps/photos/lib/ui/tabs/shared_collections_tab.dart+++ /dev/null@@ -1,506 +0,0 @@-import "dart:async";-import "dart:math";--import "package:ente_pure_utils/ente_pure_utils.dart";-import "package:flutter/material.dart";-import "package:logging/logging.dart";-import "package:photos/core/configuration.dart";-import "package:photos/core/constants.dart";-import "package:photos/core/event_bus.dart";-import "package:photos/events/album_sort_order_change_event.dart";-import "package:photos/events/app_mode_changed_event.dart";-import "package:photos/events/collection_updated_event.dart";-import "package:photos/events/local_photos_updated_event.dart";-import "package:photos/events/tab_changed_event.dart";-import "package:photos/events/user_logged_out_event.dart";-import "package:photos/generated/l10n.dart";-import "package:photos/models/api/memory_share/memory_share.dart";-import "package:photos/models/collection/collection_items.dart";-import "package:photos/models/search/generic_search_result.dart";-import "package:photos/service_locator.dart";-import "package:photos/services/collections_service.dart";-import "package:photos/services/photos_contacts_service.dart";-import "package:photos/services/search_service.dart";-import "package:photos/theme/ente_theme.dart";-import "package:photos/ui/collections/album/row_item.dart";-import "package:photos/ui/collections/collection_list_page.dart";-import "package:photos/ui/common/loading_widget.dart";-import "package:photos/ui/components/banners/shared_empty_offline_state_widget.dart";-import "package:photos/ui/components/buttons/icon_button_widget.dart";-import "package:photos/ui/social/widgets/feed_preview_widget.dart";-import "package:photos/ui/tabs/section_title.dart";-import "package:photos/ui/tabs/shared/empty_state.dart";-import "package:photos/ui/viewer/gallery/collect_photos_card_widget.dart";-import "package:photos/ui/viewer/search_tab/contacts_section.dart";--class SharedCollectionsTab extends StatefulWidget {- const SharedCollectionsTab({super.key});-- @override- State<SharedCollectionsTab> createState() => _SharedCollectionsTabState();-}--class _SharedCollectionsTabState extends State<SharedCollectionsTab>- with AutomaticKeepAliveClientMixin {- final Logger _logger = Logger("SharedCollectionGallery");- static const _sharedTabIndex = 2;- static const _feedPreviewStartupDelay = Duration(seconds: 5);- late StreamSubscription<LocalPhotosUpdatedEvent> _localFilesSubscription;- late StreamSubscription<CollectionUpdatedEvent>- _collectionUpdatesSubscription;- late StreamSubscription<AlbumSortOrderChangeEvent> _albumSortOrderChangeEvent;- late StreamSubscription<UserLoggedOutEvent> _loggedOutEvent;- late StreamSubscription<AppModeChangedEvent> _appModeChangedEvent;- final _debouncer = Debouncer(- const Duration(seconds: 2),- executionInterval: const Duration(seconds: 5),- leading: true,- );- late StreamSubscription<TabChangedEvent> _tabChangeEvent;-- // This can be used to defer loading of widgets in this tab until the tab is- // selected for a certain amount of time. This will not turn true until the- // user has been in the tab for 500ms. This is to prevent loading widgets when- // the user is just switching tabs quickly.- final _canLoadDeferredWidgets = ValueNotifier<bool>(false);- final _canLoadFeedPreview = ValueNotifier<bool>(false);- final _debouncerForDeferringLoad = Debouncer(- const Duration(milliseconds: 500),- );- Timer? _feedPreviewStartupTimer;- var _isOnSharedTab = false;- var _tabChangeSubscriptionCancelled = false;-- static const maxThumbnailWidth = 224.0;- static const crossAxisSpacing = 8.0;- static const horizontalPadding = 16.0;-- @override- void initState() {- super.initState();- _localFilesSubscription = Bus.instance.on<LocalPhotosUpdatedEvent>().listen(- (event) {- _debouncer.run(() async {- if (mounted) {- debugPrint("SetState Shared Collections on ${event.reason}");- setState(() {});- }- });- },- );- _collectionUpdatesSubscription = Bus.instance- .on<CollectionUpdatedEvent>()- .listen((event) {- _debouncer.run(() async {- if (mounted) {- debugPrint("SetState Shared Collections on ${event.reason}");- setState(() {});- }- });- });- _albumSortOrderChangeEvent = Bus.instance- .on<AlbumSortOrderChangeEvent>()- .listen((event) {- if (mounted) {- setState(() {});- }- });- _loggedOutEvent = Bus.instance.on<UserLoggedOutEvent>().listen((event) {- setState(() {});- });- _appModeChangedEvent = Bus.instance.on<AppModeChangedEvent>().listen((- event,- ) {- if (mounted) {- setState(() {});- }- });- _scheduleFeedPreviewFromSharedTabBuild();-- _tabChangeEvent = Bus.instance.on<TabChangedEvent>().listen((event) {- _isOnSharedTab = event.selectedIndex == _sharedTabIndex;- if (_isOnSharedTab) {- _enableDeferredWidgetsAfterDwell();- _enableFeedPreviewImmediately();- _warmContactsForSharedTab();- } else {- if (!_canLoadDeferredWidgets.value) {- _debouncerForDeferringLoad.cancelDebounceTimer();- }- }- });- }-- void _enableDeferredWidgetsAfterDwell() {- if (_canLoadDeferredWidgets.value) {- return;- }- _debouncerForDeferringLoad.run(() async {- _logger.info("Loading deferred widgets in shared collections tab");- if (mounted) {- _canLoadDeferredWidgets.value = true;- _maybeCancelTabChangeListener();- }- });- }-- void _scheduleFeedPreviewFromSharedTabBuild() {- if (_canLoadFeedPreview.value) {- return;- }- _feedPreviewStartupTimer?.cancel();- _feedPreviewStartupTimer = Timer(_feedPreviewStartupDelay, () {- if (!mounted || _canLoadFeedPreview.value) {- return;- }- _enableFeedPreview("shared-tab-build-delay-elapsed");- });- }-- void _enableFeedPreviewImmediately() {- _enableFeedPreview("shared-tab-selected");- }-- void _warmContactsForSharedTab() {- if (!flagService.enableContact ||- !Configuration.instance.hasConfiguredAccount() ||- !PhotosContactsService.instance.needsWarmup) {- return;- }- unawaited(_retryContactsWarmup());- }-- Future<void> _retryContactsWarmup() async {- try {- await PhotosContactsService.instance.ensureReady();- } catch (e, s) {- _logger.warning(- "Failed to warm contacts while entering shared tab",- e,- s,- );- }- }-- void _enableFeedPreview(String reason) {- if (_canLoadFeedPreview.value) {- return;- }- _feedPreviewStartupTimer?.cancel();- _feedPreviewStartupTimer = null;- _logger.info("Loading feed preview in shared collections tab ($reason)");- _canLoadFeedPreview.value = true;- _maybeCancelTabChangeListener();- }-- void _maybeCancelTabChangeListener() {- if (!_canLoadDeferredWidgets.value || !_canLoadFeedPreview.value) {- return;- }- _debouncerForDeferringLoad.cancelDebounceTimer();- _feedPreviewStartupTimer?.cancel();- _feedPreviewStartupTimer = null;- if (!_tabChangeSubscriptionCancelled) {- _tabChangeSubscriptionCancelled = true;- unawaited(_tabChangeEvent.cancel());- }- }-- @override- Widget build(BuildContext context) {- super.build(context);- final bool localGalleryMode =- isLocalGalleryMode && !Configuration.instance.hasConfiguredAccount();- return FutureBuilder<SharedCollectionsAndMemoryLinks>(- future: localGalleryMode- ? Future.value(SharedCollectionsAndMemoryLinks.empty())- : CollectionsService.instance.getSharedCollectionsAndMemoryLinks(),- builder: (context, snapshot) {- if (snapshot.hasData) {- final data = snapshot.data!;- if (localGalleryMode) {- return const SafeArea(child: SharedEmptyOfflineStateWidget());- }- if (data.collections.incoming.isEmpty &&- data.collections.quickLinks.isEmpty &&- data.collections.outgoing.isEmpty &&- data.memoryLinks.isEmpty) {- return const Center(child: SharedEmptyStateWidget());- }- return SafeArea(- child: _getSharedCollectionsGallery(- data.collections,- data.memoryLinks,- ),- );- } else if (snapshot.hasError) {- _logger.severe(- "critical: failed to load share gallery",- snapshot.error,- snapshot.stackTrace,- );- return Center(- child: Text(AppLocalizations.of(context).somethingWentWrong),- );- } else {- return const EnteLoadingWidget();- }- },- );- }-- Widget _getSharedCollectionsGallery(- SharedCollections collections,- List<MemoryShare> memoryLinks,- ) {- final double screenWidth = MediaQuery.sizeOf(context).width;- final int albumsCountInRow = max(screenWidth ~/ maxThumbnailWidth, 3);- final totalHorizontalPadding = (albumsCountInRow - 1) * crossAxisSpacing;- final sideOfThumbnail =- (screenWidth - totalHorizontalPadding - horizontalPadding) /- albumsCountInRow;- final SectionTitle sharedWithYou = SectionTitle(- title: AppLocalizations.of(context).sharedWithYou,- );- final SectionTitle sharedByYou = SectionTitle(- title: AppLocalizations.of(context).sharedByYou,- );- final colorTheme = getEnteColorScheme(context);- return SingleChildScrollView(- physics: const BouncingScrollPhysics(),- child: Container(- margin: const EdgeInsets.only(bottom: 50),- child: Column(- children: [- ValueListenableBuilder(- valueListenable: _canLoadFeedPreview,- builder: (context, canLoad, _) {- return canLoad- ? const FeedPreviewWidget()- : const SizedBox.shrink();- },- ),- Column(- mainAxisSize: MainAxisSize.min,- children: [- SectionOptions(- onTap: collections.incoming.isNotEmpty- ? () {- unawaited(- routeToPage(- context,- CollectionListPage(- collections.incoming,- sectionType: UISectionType.incomingCollections,- tag: "incoming",- appTitle: sharedWithYou,- ),- ),- );- }- : null,- Hero(tag: "incoming", child: sharedWithYou),- trailingWidget: collections.incoming.isNotEmpty- ? Row(- mainAxisSize: MainAxisSize.min,- children: [- IconButtonWidget(- icon: Icons.search,- iconButtonType: IconButtonType.secondary,- iconColor: colorTheme.blurStrokePressed,- onTap: () {- unawaited(- routeToPage(- context,- CollectionListPage(- collections.incoming,- sectionType:- UISectionType.incomingCollections,- tag: "incoming",- appTitle: sharedWithYou,- startInSearchMode: true,- ),- ),- );- },- ),- IconButtonWidget(- icon: Icons.chevron_right,- iconButtonType: IconButtonType.secondary,- iconColor: colorTheme.blurStrokePressed,- ),- ],- )- : null,- ),- const SizedBox(height: 2),- collections.incoming.isNotEmpty- ? SizedBox(- height: sideOfThumbnail + 46,- child: ListView.builder(- padding: const EdgeInsets.symmetric(- horizontal: horizontalPadding / 2,- ),- scrollDirection: Axis.horizontal,- itemBuilder: (context, index) {- return Padding(- padding: const EdgeInsets.only(- right: horizontalPadding / 2,- ),- key: ValueKey(- 'incoming_${collections.incoming[index].id}',- ),- child: AlbumRowItemWidget(- collections.incoming[index],- sideOfThumbnail,- tag: "incoming",- showFileCount: true,- ),- );- },- itemCount: collections.incoming.length,- ),- )- : const IncomingAlbumEmptyState(),- ],- ),- Column(- mainAxisSize: MainAxisSize.min,- children: [- SectionOptions(- onTap: collections.outgoing.isNotEmpty- ? () {- unawaited(- routeToPage(- context,- CollectionListPage(- collections.outgoing,- sectionType: UISectionType.outgoingCollections,- tag: "outgoing",- appTitle: sharedByYou,- ),- ),- );- }- : null,- Hero(tag: "outgoing", child: sharedByYou),- trailingWidget: collections.outgoing.isNotEmpty- ? Row(- mainAxisSize: MainAxisSize.min,- children: [- IconButtonWidget(- icon: Icons.search,- iconButtonType: IconButtonType.secondary,- iconColor: colorTheme.blurStrokePressed,- onTap: () {- unawaited(- routeToPage(- context,- CollectionListPage(- collections.outgoing,- sectionType:- UISectionType.outgoingCollections,- tag: "outgoing",- appTitle: sharedByYou,- startInSearchMode: true,- ),- ),- );- },- ),- IconButtonWidget(- icon: Icons.chevron_right,- iconButtonType: IconButtonType.secondary,- iconColor: colorTheme.blurStrokePressed,- ),- ],- )- : null,- ),- const SizedBox(height: 2),- collections.outgoing.isNotEmpty- ? SizedBox(- height: sideOfThumbnail + 46,- child: ListView.builder(- padding: const EdgeInsets.symmetric(horizontal: 8),- scrollDirection: Axis.horizontal,- itemBuilder: (context, index) {- return Padding(- padding: const EdgeInsets.only(- right: horizontalPadding / 2,- ),- key: ValueKey(- 'outgoing_${collections.outgoing[index].id}',- ),- child: AlbumRowItemWidget(- collections.outgoing[index],- sideOfThumbnail,- tag: "outgoing",- showFileCount: true,- ),- );- },- itemCount: collections.outgoing.length,- ),- )- : const OutgoingAlbumEmptyState(),- ],- ),- const SizedBox(height: 2),- ValueListenableBuilder(- valueListenable: _canLoadDeferredWidgets,- builder: (context, value, _) {- return value- ? FutureBuilder(- future: SearchService.instance- .getAllContactsSearchResults(kSearchSectionLimit),- builder: (context, snapshot) {- if (snapshot.hasData) {- return ContactsSection(- snapshot.data as List<GenericSearchResult>,- );- } else if (snapshot.hasError) {- _logger.severe(- "failed to load contacts section",- snapshot.error,- snapshot.stackTrace,- );- return const EnteLoadingWidget();- } else {- return const EnteLoadingWidget();- }- },- )- : const SizedBox.shrink();- },- ),- const CollectPhotosCardWidget(),- const SizedBox(height: 32),- ],- ),- ),- );- }-- @override- void dispose() {- _localFilesSubscription.cancel();- _collectionUpdatesSubscription.cancel();- _albumSortOrderChangeEvent.cancel();- _loggedOutEvent.cancel();- _appModeChangedEvent.cancel();- _debouncer.cancelDebounceTimer();- _debouncerForDeferringLoad.cancelDebounceTimer();- _feedPreviewStartupTimer?.cancel();- if (!_tabChangeSubscriptionCancelled) {- _tabChangeSubscriptionCancelled = true;- unawaited(_tabChangeEvent.cancel());- }- _canLoadDeferredWidgets.dispose();- _canLoadFeedPreview.dispose();- super.dispose();- }-- @override- bool get wantKeepAlive => true;-}diff --git a/mobile/apps/photos/lib/ui/tabs/user_collections_tab.dart b/mobile/apps/photos/lib/ui/tabs/user_collections_tab.dartdeleted file mode 100644index 30e5e8762d..0000000000--- a/mobile/apps/photos/lib/ui/tabs/user_collections_tab.dart+++ /dev/null@@ -1,348 +0,0 @@-import "dart:async";--import "package:ente_pure_utils/ente_pure_utils.dart";-import "package:flutter/material.dart";-import "package:logging/logging.dart";-import "package:photos/core/configuration.dart";-import "package:photos/core/event_bus.dart";-import "package:photos/events/album_sort_order_change_event.dart";-import "package:photos/events/app_mode_changed_event.dart";-import "package:photos/events/backup_folders_updated_event.dart";-import "package:photos/events/collection_updated_event.dart";-import "package:photos/events/favorites_service_init_complete_event.dart";-import "package:photos/events/local_photos_updated_event.dart";-import "package:photos/events/user_logged_out_event.dart";-import "package:photos/generated/l10n.dart";-import "package:photos/models/collection/collection.dart";-import "package:photos/models/selected_albums.dart";-import "package:photos/service_locator.dart";-import "package:photos/services/collections_service.dart";-import "package:photos/theme/ente_theme.dart";-import "package:photos/ui/collections/button/archived_button.dart";-import "package:photos/ui/collections/button/hidden_button.dart";-import "package:photos/ui/collections/button/trash_button.dart";-import "package:photos/ui/collections/button/uncategorized_button.dart";-import "package:photos/ui/collections/collection_list_page.dart";-import "package:photos/ui/collections/device/device_folders_grid_view.dart";-import "package:photos/ui/collections/device/device_folders_vertical_grid_view.dart";-import "package:photos/ui/collections/flex_grid_view.dart";-import "package:photos/ui/common/loading_widget.dart";-import "package:photos/ui/components/buttons/icon_button_widget.dart";-import "package:photos/ui/offline/empty/on_ente_empty_state.dart";-import "package:photos/ui/tabs/section_title.dart";-import "package:photos/ui/viewer/actions/album_selection_overlay_bar.dart";-import "package:photos/ui/viewer/actions/delete_empty_albums.dart";-import "package:photos/ui/viewer/gallery/empty_state.dart";--class UserCollectionsTab extends StatefulWidget {- const UserCollectionsTab({super.key, this.selectedAlbums});-- final SelectedAlbums? selectedAlbums;-- @override- State<UserCollectionsTab> createState() => _UserCollectionsTabState();-}--class _UserCollectionsTabState extends State<UserCollectionsTab>- with AutomaticKeepAliveClientMixin {- final _logger = Logger((_UserCollectionsTabState).toString());- late StreamSubscription<LocalPhotosUpdatedEvent> _localFilesSubscription;- late StreamSubscription<CollectionUpdatedEvent>- _collectionUpdatesSubscription;- late StreamSubscription<UserLoggedOutEvent> _loggedOutEvent;- late StreamSubscription<FavoritesServiceInitCompleteEvent>- _favoritesServiceInitCompleteEvent;- late StreamSubscription<AlbumSortOrderChangeEvent> _albumSortOrderChangeEvent;- late StreamSubscription<BackupFoldersUpdatedEvent> _backupFoldersUpdatedEvent;- late StreamSubscription<AppModeChangedEvent> _appModeChangedEvent;-- String _loadReason = "init";- final _scrollController = ScrollController();- final _debouncer = Debouncer(- const Duration(seconds: 2),- executionInterval: const Duration(seconds: 5),- leading: true,- );-- @override- void initState() {- super.initState();- _localFilesSubscription = Bus.instance.on<LocalPhotosUpdatedEvent>().listen(- (event) {- _debouncer.run(() async {- if (mounted) {- _loadReason = event.reason;- setState(() {});- }- });- },- );- _collectionUpdatesSubscription = Bus.instance- .on<CollectionUpdatedEvent>()- .listen((event) {- _debouncer.run(() async {- if (mounted) {- _loadReason = event.reason;- setState(() {});- }- });- });- _loggedOutEvent = Bus.instance.on<UserLoggedOutEvent>().listen((event) {- _loadReason = event.reason;- setState(() {});- });- _favoritesServiceInitCompleteEvent = Bus.instance- .on<FavoritesServiceInitCompleteEvent>()- .listen((event) {- _debouncer.run(() async {- _loadReason = event.reason;- setState(() {});- });- });- _albumSortOrderChangeEvent = Bus.instance- .on<AlbumSortOrderChangeEvent>()- .listen((event) {- _loadReason = event.reason;- setState(() {});- });- _backupFoldersUpdatedEvent = Bus.instance- .on<BackupFoldersUpdatedEvent>()- .listen((event) {- _loadReason = event.reason;- if (mounted) setState(() {});- });- _appModeChangedEvent = Bus.instance.on<AppModeChangedEvent>().listen((_) {- _loadReason = "AppModeChangedEvent";- if (mounted) {- setState(() {});- }- });- }-- @override- Widget build(BuildContext context) {- super.build(context);- _logger.info("Building, trigger: $_loadReason");- final bool localGalleryMode =- isLocalGalleryMode && !Configuration.instance.hasConfiguredAccount();- return FutureBuilder<List<Collection>>(- future: localGalleryMode- ? Future.value(<Collection>[])- : CollectionsService.instance.getCollectionForOnEnteSection(),- builder: (context, snapshot) {- if (snapshot.hasData) {- return _getCollectionsGalleryWidget(- snapshot.data!,- localGalleryMode: localGalleryMode,- );- } else if (snapshot.hasError) {- return Text(snapshot.error.toString());- } else {- return const EnteLoadingWidget();- }- },- );- }-- Widget _getCollectionsGalleryWidget(- List<Collection> collections, {- required bool localGalleryMode,- }) {- final TextStyle trashAndHiddenTextStyle = Theme.of(context)- .textTheme- .titleMedium!- .copyWith(- color: Theme.of(- context,- ).textTheme.titleMedium!.color!.withValues(alpha: 0.5),- );- final colorScheme = getEnteColorScheme(context);-- return Stack(- alignment: Alignment.bottomCenter,- children: [- CustomScrollView(- physics: const BouncingScrollPhysics(),- controller: _scrollController,- slivers: [- SliverToBoxAdapter(- child: SectionOptions(- onTap: backupPreferenceService.hasSkippedOnboardingPermission- ? null- : () {- unawaited(- routeToPage(- context,- DeviceFolderVerticalGridView(- appTitle: SectionTitle(- title: AppLocalizations.of(context).onDevice,- ),- tag: "OnDeviceAppTitle",- ),- ),- );- },- Hero(- tag: "OnDeviceAppTitle",- child: SectionTitle(- title: AppLocalizations.of(context).onDevice,- ),- ),- trailingWidget:- backupPreferenceService.hasSkippedOnboardingPermission- ? null- : Row(- mainAxisSize: MainAxisSize.min,- children: [- IconButtonWidget(- icon: Icons.search,- iconButtonType: IconButtonType.secondary,- iconColor: colorScheme.blurStrokePressed,- onTap: () {- unawaited(- routeToPage(- context,- DeviceFolderVerticalGridView(- appTitle: SectionTitle(- title: AppLocalizations.of(- context,- ).onDevice,- ),- tag: "OnDeviceAppTitle",- startInSearchMode: true,- ),- ),- );- },- ),- IconButtonWidget(- icon: Icons.chevron_right,- iconButtonType: IconButtonType.secondary,- iconColor: colorScheme.blurStrokePressed,- ),- ],- ),- ),- ),- const SliverToBoxAdapter(child: DeviceFoldersGridView()),- SliverToBoxAdapter(- child: SectionOptions(- onTap: localGalleryMode- ? null- : () {- unawaited(- routeToPage(- context,- CollectionListPage(- collections,- sectionType: UISectionType.homeCollections,- appTitle: SectionTitle(- titleWithBrand: getOnEnteSection(context),- ),- ),- ),- );- },- SectionTitle(titleWithBrand: getOnEnteSection(context)),- trailingWidget: localGalleryMode- ? null- : Row(- mainAxisSize: MainAxisSize.min,- children: [- IconButtonWidget(- icon: Icons.search,- iconButtonType: IconButtonType.secondary,- iconColor: colorScheme.blurStrokePressed,- onTap: () {- unawaited(- routeToPage(- context,- CollectionListPage(- collections,- sectionType: UISectionType.homeCollections,- appTitle: SectionTitle(- titleWithBrand: getOnEnteSection(context),- ),- startInSearchMode: true,- ),- ),- );- },- ),- IconButtonWidget(- icon: Icons.chevron_right,- iconButtonType: IconButtonType.secondary,- iconColor: colorScheme.blurStrokePressed,- ),- ],- ),- ),- ),- const SliverToBoxAdapter(child: DeleteEmptyAlbums()),- localGalleryMode- ? const SliverToBoxAdapter(child: EmptyOnEnteSection())- : Configuration.instance.hasConfiguredAccount()- ? CollectionsFlexiGridViewWidget(- collections,- selectedAlbums: widget.selectedAlbums,- shrinkWrap: true,- shouldShowCreateAlbum: true,- enableSelectionMode: true,- )- : const SliverToBoxAdapter(child: EmptyState()),- if (!localGalleryMode) ...[- SliverToBoxAdapter(- child: Divider(color: colorScheme.strokeFaint),- ),- const SliverToBoxAdapter(child: SizedBox(height: 12)),- SliverToBoxAdapter(- child: Padding(- padding: const EdgeInsets.symmetric(horizontal: 12),- child: Column(- children: [- UnCategorizedCollections(trashAndHiddenTextStyle),- const SizedBox(height: 12),- ArchivedCollectionsButton(trashAndHiddenTextStyle),- const SizedBox(height: 12),- HiddenCollectionsButtonWidget(trashAndHiddenTextStyle),- const SizedBox(height: 12),- TrashSectionButton(trashAndHiddenTextStyle),- ],- ),- ),- ),- ],- SliverToBoxAdapter(- child: SizedBox(- height: 64 + MediaQuery.paddingOf(context).bottom,- ),- ),- ],- ),- AlbumSelectionOverlayBar(- widget.selectedAlbums!,- UISectionType.homeCollections,- collections,- showSelectAllButton: false,- ),- ],- );- }-- @override- void dispose() {- _localFilesSubscription.cancel();- _collectionUpdatesSubscription.cancel();- _loggedOutEvent.cancel();- _favoritesServiceInitCompleteEvent.cancel();- _scrollController.dispose();- _debouncer.cancelDebounceTimer();- _albumSortOrderChangeEvent.cancel();- _backupFoldersUpdatedEvent.cancel();- _appModeChangedEvent.cancel();- super.dispose();- }-- @override- bool get wantKeepAlive => true;-}diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/collect_photos_card_widget.dart b/mobile/apps/photos/lib/ui/viewer/gallery/collect_photos_card_widget.dartdeleted file mode 100644index 0ef56edcf9..0000000000--- a/mobile/apps/photos/lib/ui/viewer/gallery/collect_photos_card_widget.dart+++ /dev/null@@ -1,138 +0,0 @@-import "package:figma_squircle/figma_squircle.dart";-import 'package:flutter/material.dart';-import "package:photos/generated/l10n.dart";-import "package:photos/theme/ente_theme.dart";-import "package:photos/ui/components/buttons/button_widget.dart";-import "package:photos/ui/components/models/button_type.dart";-import "package:photos/utils/collection_util.dart";--class CollectPhotosCardWidget extends StatefulWidget {- const CollectPhotosCardWidget({super.key});-- @override- State<CollectPhotosCardWidget> createState() =>- _CollectPhotosCardWidgetState();-}--class _CollectPhotosCardWidgetState extends State<CollectPhotosCardWidget> {- @override- Widget build(BuildContext context) {- final textTheme = getEnteTextTheme(context);- final colorTheme = getEnteColorScheme(context);- return Stack(- children: [- Positioned(- bottom: 22.5,- left: 14.5,- child: Container(- height: 125,- width: 125,- decoration: ShapeDecoration(- gradient: LinearGradient(- colors: [- colorTheme.primary700.withValues(alpha: 0.9),- colorTheme.backdropBase.withValues(alpha: 0.6),- colorTheme.backdropBase,- ],- begin: Alignment.bottomLeft,- end: Alignment.topRight,- ),- shape: SmoothRectangleBorder(- borderRadius: SmoothBorderRadius(- cornerRadius: 12.0,- cornerSmoothing: 1.0,- ),- ),- ),- ),- ),- GestureDetector(- onTap: () => onTapCollectEventPhotos(context),- child: Padding(- padding: const EdgeInsets.fromLTRB(16, 16, 16, 24),- child: Container(- decoration: ShapeDecoration(- color: colorTheme.backgroundElevated,- shadows: [- BoxShadow(- color: colorTheme.textBase.withValues(alpha: 0.1),- blurRadius: 4.0,- offset: const Offset(0, 1),- ),- ],- shape: SmoothRectangleBorder(- borderRadius: SmoothBorderRadius(- cornerRadius: 10.0,- cornerSmoothing: 1.0,- ),- ),- ),- child: Padding(- padding: const EdgeInsets.symmetric(- horizontal: 12,- vertical: 16,- ),- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Text(- AppLocalizations.of(context).collectPhotos,- style: textTheme.bodyBold,- ),- const SizedBox(height: 16),- Text(- AppLocalizations.of(context).collectPhotosDescription,- style: textTheme.smallMuted,- ),- const SizedBox(height: 34),- Row(- mainAxisAlignment: MainAxisAlignment.end,- children: [- ButtonWidget(- buttonType: ButtonType.primary,- buttonSize: ButtonSize.small,- labelText: AppLocalizations.of(context).collect,- icon: Icons.add_photo_alternate_outlined,- shouldShowSuccessConfirmation: false,- shouldSurfaceExecutionStates: false,- onTap: () => onTapCollectEventPhotos(context),- ),- ],- ),- ],- ),- ),- ),- ),- ),- Positioned(- bottom: 24,- left: 16,- child: Container(- height: 90,- width: 90,- decoration: BoxDecoration(- borderRadius: const BorderRadius.only(- bottomLeft: Radius.circular(10),- ),- gradient: LinearGradient(- colors: [- colorTheme.primary700.withValues(alpha: 0.4),- colorTheme.backgroundElevated.withValues(alpha: 0.6),- colorTheme.backgroundElevated,- ],- begin: Alignment.bottomLeft,- end: Alignment.topRight,- ),- ),- ),- ),- Positioned(- bottom: 25,- left: 20,- child: SizedBox(child: Image.asset('assets/create_new_album.png')),- ),- ],- );- }-}diff --git a/mobile/apps/photos/lib/utils/collection_util.dart b/mobile/apps/photos/lib/utils/collection_util.dartindex 7d748a67ed..90f76610b4 100644--- a/mobile/apps/photos/lib/utils/collection_util.dart+++ b/mobile/apps/photos/lib/utils/collection_util.dart@@ -1,59 +1,11 @@import "package:android_intent_plus/android_intent.dart";-import "package:ente_pure_utils/ente_pure_utils.dart";import "package:flutter/material.dart";-import "package:intl/intl.dart";import "package:logging/logging.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/service_locator.dart";-import "package:photos/services/collections_service.dart";import "package:photos/ui/components/buttons/button_widget.dart";-import "package:photos/ui/viewer/gallery/collection_page.dart";import "package:photos/utils/dialog_util.dart";-Future<void> onTapCollectEventPhotos(BuildContext context) async {- final String currentDate = DateFormat('MMMM d, yyyy').format(DateTime.now());- final result = await showTextInputDialog(- context,- title: AppLocalizations.of(context).nameTheAlbum,- submitButtonLabel: AppLocalizations.of(context).create,- hintText: AppLocalizations.of(context).enterAlbumName,- alwaysShowSuccessState: false,- initialValue: currentDate,- textCapitalization: TextCapitalization.words,- popnavAfterSubmission: false,- onSubmit: (String text) async {- // indicates user cancelled the rename request- if (text.trim() == "") {- return;- }-- try {- final Collection c = await CollectionsService.instance.createAlbum(- text,- );- await routeToPage(- context,- CollectionPage(- isFromCollectPhotos: true,- CollectionWithThumbnail(c, null),- ),- );- Navigator.of(context).pop();- } catch (e, s) {- Logger(- "Collect event photos from CollectPhotosCardWidget",- ).severe("Failed to rename album", e, s);- rethrow;- }- },- );- if (result is Exception) {- await showGenericErrorDialog(context: context, error: result);- }-}-Future<void> requestPermissionToOpenLinksInApp(BuildContext context,String packageName,