π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[locker] Move Collections and Trash to settings page
ashilkn4811a55beb35
diff --git a/mobile/apps/locker/lib/ui/components/legacy_collections_trash_widget.dart b/mobile/apps/locker/lib/ui/components/legacy_collections_trash_widget.dartnew file mode 100644index 0000000000..cb440be6ed--- /dev/null+++ b/mobile/apps/locker/lib/ui/components/legacy_collections_trash_widget.dart@@ -0,0 +1,143 @@+import "package:ente_ui/theme/ente_theme.dart";+import "package:flutter/material.dart";+import "package:hugeicons/hugeicons.dart";+import "package:locker/l10n/l10n.dart";+import "package:locker/services/trash/trash_service.dart";+import "package:locker/ui/pages/all_collections_page.dart";+import "package:locker/ui/pages/trash_page.dart";++class LegacyCollectionsTrashWidget extends StatelessWidget {+ const LegacyCollectionsTrashWidget({super.key});++ @override+ Widget build(BuildContext context) {+ return Column(+ children: [+ _buildCollectionsItem(context),+ _buildTrashItem(context),+ ],+ );+ }++ Widget _buildCollectionsItem(BuildContext context) {+ final textTheme = getEnteTextTheme(context);+ final borderRadius = BorderRadius.circular(20.0);++ return Container(+ margin: const EdgeInsets.only(top: 4.0, bottom: 8.0),+ child: InkWell(+ onTap: () => _openCollections(context),+ borderRadius: borderRadius,+ child: Container(+ padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),+ decoration: BoxDecoration(+ color: Theme.of(context).colorScheme.surface.withAlpha(30),+ border: Border.all(+ color: Theme.of(context).dividerColor.withAlpha(50),+ width: 0.5,+ ),+ borderRadius: borderRadius,+ ),+ child: Row(+ children: [+ HugeIcon(+ icon: HugeIcons.strokeRoundedWallet05,+ color:+ Theme.of(context).textTheme.bodyLarge?.color?.withAlpha(70),+ size: 22,+ ),+ const SizedBox(width: 12),+ Expanded(+ child: Text(+ context.l10n.collections,+ style: textTheme.large.copyWith(+ fontWeight: FontWeight.w500,+ ),+ ),+ ),+ Icon(+ Icons.chevron_right,+ color: Theme.of(context)+ .textTheme+ .bodyMedium+ ?.color+ ?.withAlpha(60),+ size: 20,+ ),+ ],+ ),+ ),+ ),+ );+ }++ Widget _buildTrashItem(BuildContext context) {+ final textTheme = getEnteTextTheme(context);+ final borderRadius = BorderRadius.circular(20.0);++ return Container(+ margin: const EdgeInsets.only(top: 4.0, bottom: 16.0),+ child: InkWell(+ onTap: () => _openTrash(context),+ borderRadius: borderRadius,+ child: Container(+ padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),+ decoration: BoxDecoration(+ color: Theme.of(context).colorScheme.surface.withAlpha(30),+ border: Border.all(+ color: Theme.of(context).dividerColor.withAlpha(50),+ width: 0.5,+ ),+ borderRadius: borderRadius,+ ),+ child: Row(+ children: [+ HugeIcon(+ icon: HugeIcons.strokeRoundedDelete01,+ color:+ Theme.of(context).textTheme.bodyLarge?.color?.withAlpha(70),+ size: 22,+ ),+ const SizedBox(width: 12),+ Expanded(+ child: Text(+ context.l10n.trash,+ style: textTheme.large.copyWith(+ fontWeight: FontWeight.w500,+ ),+ ),+ ),+ Icon(+ Icons.chevron_right,+ color: Theme.of(context)+ .textTheme+ .bodyMedium+ ?.color+ ?.withAlpha(60),+ size: 20,+ ),+ ],+ ),+ ),+ ),+ );+ }++ Future<void> _openCollections(BuildContext context) async {+ await Navigator.of(context).push(+ MaterialPageRoute(+ builder: (context) => const AllCollectionsPage(),+ ),+ );+ }++ Future<void> _openTrash(BuildContext context) async {+ final trashFiles = await TrashService.instance.getTrashFiles();+ if (!context.mounted) return;+ await Navigator.of(context).push(+ MaterialPageRoute(+ builder: (context) => TrashPage(trashFiles: trashFiles),+ ),+ );+ }+}diff --git a/mobile/apps/locker/lib/ui/pages/all_collections_page.dart b/mobile/apps/locker/lib/ui/pages/all_collections_page.dartindex df6091c94a..1c2e921dd4 100644--- a/mobile/apps/locker/lib/ui/pages/all_collections_page.dart+++ b/mobile/apps/locker/lib/ui/pages/all_collections_page.dart@@ -11,11 +11,9 @@ import 'package:locker/models/selected_collections.dart';import 'package:locker/models/ui_section_type.dart';import 'package:locker/services/collections/collections_service.dart';import 'package:locker/services/collections/models/collection.dart';-import 'package:locker/services/trash/trash_service.dart';import "package:locker/ui/components/empty_state_widget.dart";import 'package:locker/ui/components/item_list_view.dart';import 'package:locker/ui/pages/collection_page.dart';-import 'package:locker/ui/pages/trash_page.dart';import 'package:locker/utils/collection_sort_util.dart';import 'package:logging/logging.dart';@@ -39,7 +37,6 @@ class _AllCollectionsPageState extends State<AllCollectionsPage> {int? _uncategorizedFileCount;bool _isLoading = true;String? _error;- bool showTrash = false;bool showUncategorized = false;final _logger = Logger("AllCollectionsPage");StreamSubscription<CollectionsUpdatedEvent>? _collectionsUpdatedSub;@@ -54,7 +51,6 @@ class _AllCollectionsPageState extends State<AllCollectionsPage> {await _loadCollections(showLoading: false);});if (widget.viewType == UISectionType.homeCollections) {- showTrash = true;showUncategorized = true;}}@@ -222,7 +218,6 @@ class _AllCollectionsPageState extends State<AllCollectionsPage> {const SizedBox(height: 20),if (_uncategorizedCollection != null && showUncategorized)_buildUncategorizedHook(),- if (showTrash) _buildTrashHook(),],),),@@ -257,73 +252,11 @@ class _AllCollectionsPageState extends State<AllCollectionsPage> {),if (_uncategorizedCollection != null && showUncategorized)_buildUncategorizedHook(),- if (showTrash) _buildTrashHook(),],),);}- Widget _buildTrashHook() {- final textTheme = getEnteTextTheme(context);- final borderRadius = BorderRadius.circular(20.0);-- return Container(- margin: const EdgeInsets.only(top: 4.0, bottom: 16.0),- child: InkWell(- onTap: _openTrash,- borderRadius: borderRadius,- child: Container(- padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 16.0),- decoration: BoxDecoration(- color: Theme.of(context).colorScheme.surface.withAlpha(30),- border: Border.all(- color: Theme.of(context).dividerColor.withAlpha(50),- width: 0.5,- ),- borderRadius: borderRadius,- ),- child: Row(- children: [- HugeIcon(- icon: HugeIcons.strokeRoundedDelete01,- color:- Theme.of(context).textTheme.bodyLarge?.color?.withAlpha(70),- size: 22,- ),- const SizedBox(width: 12),- Expanded(- child: Text(- context.l10n.trash,- style: textTheme.large.copyWith(- fontWeight: FontWeight.w500,- ),- ),- ),- Icon(- Icons.chevron_right,- color: Theme.of(context)- .textTheme- .bodyMedium- ?.color- ?.withAlpha(60),- size: 20,- ),- ],- ),- ),- ),- );- }-- Future<void> _openTrash() async {- final trashFiles = await TrashService.instance.getTrashFiles();- await Navigator.of(context).push(- MaterialPageRoute(- builder: (context) => TrashPage(trashFiles: trashFiles),- ),- );- }-Widget _buildUncategorizedHook() {if (_uncategorizedCollection == null) return const SizedBox.shrink();diff --git a/mobile/apps/locker/lib/ui/pages/home_page.dart b/mobile/apps/locker/lib/ui/pages/home_page.dartindex 8beb80c8f1..d0dd363fa6 100644--- a/mobile/apps/locker/lib/ui/pages/home_page.dart+++ b/mobile/apps/locker/lib/ui/pages/home_page.dart@@ -3,7 +3,6 @@ import 'dart:io';import "package:ente_accounts/services/user_service.dart";import 'package:ente_events/event_bus.dart';-import "package:ente_ui/components/buttons/icon_button_widget.dart";import 'package:ente_ui/theme/ente_theme.dart';import 'package:ente_ui/utils/dialog_util.dart';import 'package:ente_utils/email_util.dart';@@ -12,18 +11,13 @@ import "package:hugeicons/hugeicons.dart";import 'package:listen_sharing_intent/listen_sharing_intent.dart';import 'package:locker/events/collections_updated_event.dart';import 'package:locker/l10n/l10n.dart';-import 'package:locker/models/selected_collections.dart';-import 'package:locker/models/ui_section_type.dart';import 'package:locker/services/collections/collections_service.dart';import 'package:locker/services/collections/models/collection.dart';import 'package:locker/services/files/sync/models/file.dart';-import "package:locker/ui/collections/collection_flex_grid_view.dart";-import "package:locker/ui/collections/section_title.dart";import "package:locker/ui/components/home_empty_state_widget.dart";import 'package:locker/ui/components/recents_section_widget.dart';import 'package:locker/ui/components/search_result_view.dart';import 'package:locker/ui/mixins/search_mixin.dart';-import 'package:locker/ui/pages/all_collections_page.dart';import 'package:locker/ui/pages/save_page.dart';import "package:locker/ui/pages/settings_page.dart";import 'package:locker/ui/pages/uploader_page.dart';@@ -202,11 +196,9 @@ class _HomePageState extends UploaderPageState<HomePage>bool _isSettingsOpen = false;List<Collection> _collections = [];- late final SelectedCollections _selectedCollections;List<Collection> _filteredCollections = [];List<EnteFile> _recentFiles = [];List<EnteFile> _filteredFiles = [];- List<Collection> homeCollections = [];String? _error;final _logger = Logger('HomePage');@@ -255,14 +247,9 @@ class _HomePageState extends UploaderPageState<HomePage>return CollectionSortUtil.filterAndSortCollections(collections);}- List<Collection> getOnEnteCollections(List<Collection> collections) {- return _filterOutUncategorized(collections);- }-@overridevoid initState() {super.initState();- _selectedCollections = SelectedCollections();_loadCollections();@@ -425,7 +412,6 @@ class _HomePageState extends UploaderPageState<HomePage>if (mounted) {setState(() {- homeCollections = getOnEnteCollections(sortedCollections);_collections = sortedCollections;_filteredCollections = _filterOutUncategorized(sortedCollections);_filteredFiles = _recentFiles;@@ -640,11 +626,6 @@ class _HomePageState extends UploaderPageState<HomePage>child: Column(crossAxisAlignment: CrossAxisAlignment.start,children: [- ..._buildCollectionSection(- title: context.l10n.collections,- collections: homeCollections,- viewType: UISectionType.homeCollections,- ),_buildRecentsSection(),],),@@ -664,39 +645,6 @@ class _HomePageState extends UploaderPageState<HomePage>);}- List<Widget> _buildCollectionSection({- required String title,- required List<Collection> collections,- required UISectionType viewType,- }) {- final colorScheme = getEnteColorScheme(context);- return [- SectionOptions(- SectionTitle(title: title),- onTap: () {- Navigator.of(context).push(- MaterialPageRoute(- builder: (context) => AllCollectionsPage(- viewType: viewType,- selectedCollections: _selectedCollections,- ),- ),- );- },- trailingWidget: IconButtonWidget(- icon: Icons.chevron_right,- iconButtonType: IconButtonType.secondary,- iconColor: colorScheme.textBase,- ),- ),- const SizedBox(height: 12),- CollectionFlexGridViewWidget(- collections: collections,- ),- const SizedBox(height: 24),- ];- }-void _openSavePage() {showSaveBottomSheet(context,diff --git a/mobile/apps/locker/lib/ui/pages/settings_page.dart b/mobile/apps/locker/lib/ui/pages/settings_page.dartindex decba12607..09b2bd722a 100644--- a/mobile/apps/locker/lib/ui/pages/settings_page.dart+++ b/mobile/apps/locker/lib/ui/pages/settings_page.dart@@ -6,6 +6,7 @@ import "package:ente_ui/theme/ente_theme.dart";import "package:flutter/foundation.dart";import "package:flutter/material.dart";import "package:locker/services/configuration.dart";+import "package:locker/ui/components/legacy_collections_trash_widget.dart";import "package:locker/ui/components/usage_card_widget.dart";import "package:locker/ui/settings/about_section_widget.dart";import 'package:locker/ui/settings/account_section_widget.dart';@@ -73,6 +74,7 @@ class SettingsPage extends StatelessWidget {const SizedBox(height: 12),const UsageCardWidget(),const SizedBox(height: 12),+ const LegacyCollectionsTrashWidget(),const AccountSectionWidget(),sectionSpacing,]);