π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Remove header sorting and simplify file/collection display
vishnukvmd89b53fc76585
diff --git a/mobile/apps/locker/lib/ui/components/collection_row_widget.dart b/mobile/apps/locker/lib/ui/components/collection_row_widget.dartindex e5d97b9ca2..8480b921b1 100644--- a/mobile/apps/locker/lib/ui/components/collection_row_widget.dart+++ b/mobile/apps/locker/lib/ui/components/collection_row_widget.dart@@ -10,7 +10,6 @@ import "package:locker/services/configuration.dart";import "package:locker/ui/components/item_list_view.dart";import "package:locker/ui/pages/collection_page.dart";import "package:locker/utils/collection_actions.dart";-import "package:locker/utils/date_time_util.dart";class CollectionRowWidget extends StatelessWidget {final Collection collection;@@ -26,9 +25,6 @@ class CollectionRowWidget extends StatelessWidget {@overrideWidget build(BuildContext context) {- final updateTime =- DateTime.fromMicrosecondsSinceEpoch(collection.updationTime);-final textTheme = getEnteTextTheme(context);final colorScheme = getEnteColorScheme(context);@@ -58,30 +54,17 @@ class CollectionRowWidget extends StatelessWidget {overflow: TextOverflow.ellipsis,maxLines: 1,),- Row(- children: [- Text(- formatDate(context, updateTime),+ FutureBuilder<int>(+ future: CollectionService.instance.getFileCount(collection),+ builder: (context, snapshot) {+ final fileCount = snapshot.data ?? 0;+ return Text(+ context.l10n.items(fileCount),style: textTheme.small.copyWith(color: colorScheme.textMuted,),- overflow: TextOverflow.ellipsis,- maxLines: 1,- ),- FutureBuilder<int>(- future:- CollectionService.instance.getFileCount(collection),- builder: (context, snapshot) {- final fileCount = snapshot.data ?? 0;- return Text(- ' β’ ' + context.l10n.items(fileCount),- style: textTheme.small.copyWith(- color: colorScheme.textMuted,- ),- );- },- ),- ],+ );+ },),],),diff --git a/mobile/apps/locker/lib/ui/components/file_row_widget.dart b/mobile/apps/locker/lib/ui/components/file_row_widget.dartindex 7cf86b405c..8d510827fc 100644--- a/mobile/apps/locker/lib/ui/components/file_row_widget.dart+++ b/mobile/apps/locker/lib/ui/components/file_row_widget.dart@@ -24,8 +24,6 @@ import "package:locker/ui/pages/base_info_page.dart";import "package:locker/ui/pages/emergency_contact_page.dart";import "package:locker/ui/pages/personal_note_page.dart";import "package:locker/ui/pages/physical_records_page.dart";-import "package:locker/utils/data_util.dart";-import "package:locker/utils/date_time_util.dart";import "package:locker/utils/file_icon_utils.dart";import "package:locker/utils/snack_bar_utils.dart";import "package:open_file/open_file.dart";@@ -46,15 +44,6 @@ class FileRowWidget extends StatelessWidget {@overrideWidget build(BuildContext context) {- final updateTime = file.updationTime != null- ? DateTime.fromMicrosecondsSinceEpoch(file.updationTime!)- : (file.modificationTime != null- ? DateTime.fromMillisecondsSinceEpoch(file.modificationTime!)- : (file.creationTime != null- ? DateTime.fromMillisecondsSinceEpoch(file.creationTime!)- : DateTime.now()));-- final textTheme = getEnteTextTheme(context);final colorScheme = getEnteColorScheme(context);final fileRowWidget = Flexible(@@ -77,30 +66,6 @@ class FileRowWidget extends StatelessWidget {overflow: TextOverflow.ellipsis,maxLines: 1,),- Row(- children: [- Text(- formatDate(context, updateTime),- style: textTheme.small.copyWith(- color: colorScheme.textMuted,- ),- overflow: TextOverflow.ellipsis,- maxLines: 1,- ),- FutureBuilder<int>(- future: CollectionService.instance.getFileSize(file),- builder: (context, snapshot) {- final size = snapshot.data ?? 0;- return Text(- ' β’ ' + formatBytes(size),- style: getEnteTextTheme(context).small.copyWith(- color: colorScheme.textMuted,- ),- );- },- ),- ],- ),],),),diff --git a/mobile/apps/locker/lib/ui/components/item_list_view.dart b/mobile/apps/locker/lib/ui/components/item_list_view.dartindex a90f8a1747..a5407e7af4 100644--- a/mobile/apps/locker/lib/ui/components/item_list_view.dart+++ b/mobile/apps/locker/lib/ui/components/item_list_view.dart@@ -30,7 +30,6 @@ class OverflowMenuAction {class ItemListView extends StatefulWidget {final List<EnteFile> files;final List<Collection> collections;- final bool enableSorting;final Widget? emptyStateWidget;final List<OverflowMenuAction>? fileOverflowActions;final List<OverflowMenuAction>? collectionOverflowActions;@@ -39,7 +38,6 @@ class ItemListView extends StatefulWidget {super.key,this.files = const [],this.collections = const [],- this.enableSorting = false,this.emptyStateWidget,this.fileOverflowActions,this.collectionOverflowActions,@@ -51,8 +49,6 @@ class ItemListView extends StatefulWidget {class _ItemListViewState extends State<ItemListView> {List<_ListItem> _sortedItems = [];- int _sortColumnIndex = 1;- bool _sortAscending = false;@overridevoid initState() {@@ -77,57 +73,6 @@ class _ItemListViewState extends State<ItemListView> {...sortedCollections.map((c) => _CollectionListItem(c)),...widget.files.map((f) => _FileListItem(f)),];-- if (widget.enableSorting) {- _sortItems(_sortColumnIndex, _sortAscending);- }- }-- void _sortItems(int columnIndex, bool ascending) {- if (!widget.enableSorting) return;-- setState(() {- _sortColumnIndex = columnIndex;- _sortAscending = ascending;-- final files = _sortedItems.whereType<_FileListItem>().toList();- final collections =- _sortedItems.whereType<_CollectionListItem>().toList();-- switch (columnIndex) {- case 0:- files.sort((a, b) {- final nameA = a.name.toLowerCase();- final nameB = b.name.toLowerCase();- return ascending ? nameA.compareTo(nameB) : nameB.compareTo(nameA);- });- collections.sort((a, b) {- return CollectionSortUtil.compareCollectionsWithFavoritesPriority(- a.collection,- b.collection,- ascending,- );- });- break;- case 1:- files.sort((a, b) {- final dateA = a.modificationTime;- final dateB = b.modificationTime;- return ascending ? dateA.compareTo(dateB) : dateB.compareTo(dateA);- });- collections.sort((a, b) {- return CollectionSortUtil- .compareCollectionsByDateWithFavoritesPriority(- a.collection,- b.collection,- ascending,- );- });- break;- }-- _sortedItems = [...collections, ...files];- });}@override@@ -143,7 +88,6 @@ class _ItemListViewState extends State<ItemListView> {return Column(mainAxisSize: MainAxisSize.min,children: [- if (widget.enableSorting) _buildSortingHeader(context),ListView.separated(separatorBuilder: (context, index) {return const SizedBox(height: 8);@@ -192,83 +136,6 @@ class _ItemListViewState extends State<ItemListView> {),);}-- Widget _buildSortingHeader(BuildContext context) {- return Container(- padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),- child: Row(- children: [- Expanded(- flex: 2,- child: GestureDetector(- behavior: HitTestBehavior.translucent,- onTap: () =>- _sortItems(0, _sortColumnIndex == 0 ? !_sortAscending : true),- child: Container(- width: double.infinity,- padding: const EdgeInsets.symmetric(vertical: 8.0),- child: Row(- children: [- Flexible(- child: Text(- context.l10n.name,- style: const TextStyle(fontWeight: FontWeight.bold),- overflow: TextOverflow.ellipsis,- maxLines: 1,- ),- ),- const SizedBox(width: 8),- if (_sortColumnIndex == 0)- Icon(- _sortAscending- ? Icons.arrow_upward- : Icons.arrow_downward,- size: 16,- color: getEnteColorScheme(context).textMuted,- ),- ],- ),- ),- ),- ),- Expanded(- flex: 1,- child: GestureDetector(- behavior: HitTestBehavior.translucent,- onTap: () =>- _sortItems(1, _sortColumnIndex == 1 ? !_sortAscending : true),- child: Container(- width: double.infinity,- padding: const EdgeInsets.symmetric(vertical: 8.0),- child: Row(- children: [- Flexible(- child: Text(- context.l10n.date,- style: const TextStyle(fontWeight: FontWeight.bold),- overflow: TextOverflow.ellipsis,- maxLines: 1,- ),- ),- const SizedBox(width: 8),- if (_sortColumnIndex == 1)- Icon(- _sortAscending- ? Icons.arrow_upward- : Icons.arrow_downward,- size: 16,- color: getEnteColorScheme(context).textMuted,- ),- ],- ),- ),- ),- ),- const SizedBox(width: 48),- ],- ),- );- }}abstract class _ListItem {diff --git a/mobile/apps/locker/lib/ui/components/recents_section_widget.dart b/mobile/apps/locker/lib/ui/components/recents_section_widget.dartindex ed30e5fbf8..3908275702 100644--- a/mobile/apps/locker/lib/ui/components/recents_section_widget.dart+++ b/mobile/apps/locker/lib/ui/components/recents_section_widget.dart@@ -292,7 +292,6 @@ class _RecentsSectionWidgetState extends State<RecentsSectionWidget> {return ItemListView(files: _displayedFiles,- enableSorting: true,);}diff --git a/mobile/apps/locker/lib/ui/components/search_result_view.dart b/mobile/apps/locker/lib/ui/components/search_result_view.dartindex 6096495a57..153238a4ec 100644--- a/mobile/apps/locker/lib/ui/components/search_result_view.dart+++ b/mobile/apps/locker/lib/ui/components/search_result_view.dart@@ -7,7 +7,6 @@ class SearchResultView extends StatelessWidget {final List<Collection> collections;final List<EnteFile> files;final String searchQuery;- final bool enableSorting;final VoidCallback? onCollectionTap;final bool isHomePage;final VoidCallback? onSearchEverywhere;@@ -18,7 +17,6 @@ class SearchResultView extends StatelessWidget {required this.collections,required this.files,this.searchQuery = '',- this.enableSorting = false,this.onCollectionTap,this.isHomePage = false,this.onSearchEverywhere,@@ -38,7 +36,6 @@ class SearchResultView extends StatelessWidget {ItemListView(files: files,collections: displayCollections,- enableSorting: enableSorting,emptyStateWidget: searchQuery.isNotEmpty? FileListViewHelpers.createSearchEmptyState(searchQuery: searchQuery,diff --git a/mobile/apps/locker/lib/ui/pages/all_collections_page.dart b/mobile/apps/locker/lib/ui/pages/all_collections_page.dartindex 5219137a7d..394bdc7b84 100644--- a/mobile/apps/locker/lib/ui/pages/all_collections_page.dart+++ b/mobile/apps/locker/lib/ui/pages/all_collections_page.dart@@ -209,7 +209,6 @@ class _AllCollectionsPageState extends State<AllCollectionsPage>collections: _sortedCollections,files: const [],searchQuery: searchQuery,- enableSorting: true,isHomePage: false,onSearchEverywhere: _searchEverywhere,),@@ -267,7 +266,6 @@ class _AllCollectionsPageState extends State<AllCollectionsPage>Flexible(child: ItemListView(collections: _sortedCollections,- enableSorting: true,),),if (!isSearchActive &&diff --git a/mobile/apps/locker/lib/ui/pages/collection_page.dart b/mobile/apps/locker/lib/ui/pages/collection_page.dartindex 65204e88cc..95d6919db3 100644--- a/mobile/apps/locker/lib/ui/pages/collection_page.dart+++ b/mobile/apps/locker/lib/ui/pages/collection_page.dart@@ -314,7 +314,6 @@ class _CollectionPageState extends UploaderPageState<CollectionPage>collections: const [], // CollectionPage primarily shows filesfiles: _filteredFiles,searchQuery: searchQuery,- enableSorting: true,isHomePage: false,onSearchEverywhere: _searchEverywhere,);@@ -335,7 +334,6 @@ class _CollectionPageState extends UploaderPageState<CollectionPage>: ItemListView(key: ValueKey(_displayedFiles.length),files: _displayedFiles,- enableSorting: true,);}diff --git a/mobile/apps/locker/lib/ui/pages/home_page.dart b/mobile/apps/locker/lib/ui/pages/home_page.dartindex acc1ff6956..b801a4f891 100644--- a/mobile/apps/locker/lib/ui/pages/home_page.dart+++ b/mobile/apps/locker/lib/ui/pages/home_page.dart@@ -459,7 +459,6 @@ class _HomePageState extends UploaderPageState<HomePage>collections: _filteredCollections,files: _filteredFiles,searchQuery: searchQuery,- enableSorting: true,isHomePage: true,),);diff --git a/mobile/apps/locker/lib/ui/pages/trash_page.dart b/mobile/apps/locker/lib/ui/pages/trash_page.dartindex 5f4261898d..271666ba3a 100644--- a/mobile/apps/locker/lib/ui/pages/trash_page.dart+++ b/mobile/apps/locker/lib/ui/pages/trash_page.dart@@ -250,7 +250,6 @@ class _TrashPageState extends State<TrashPage> {padding: const EdgeInsets.all(16.0),child: ItemListView(files: _sortedTrashFiles.cast<EnteFile>(),- enableSorting: true,fileOverflowActions: _getFileOverflowActions(),),);