Skip to content

armgit / ente

Public Imported from GitHub
0

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

Refactor, simplify and fix scrolling issues on all collections page

ashilknc4299e942b93
diff --git a/mobile/apps/locker/lib/ui/components/item_list_view.dart b/mobile/apps/locker/lib/ui/components/item_list_view.dart
index fabe80a787..600c2db2f4 100644
--- a/mobile/apps/locker/lib/ui/components/item_list_view.dart
+++ b/mobile/apps/locker/lib/ui/components/item_list_view.dart
@@ -46,6 +46,7 @@ class ItemListView extends StatefulWidget {
final SelectedCollections? selectedCollections;
final SelectedFiles? selectedFiles;
final ItemViewType viewType;
+ final ScrollPhysics? physics;
const ItemListView({
super.key,
@@ -57,6 +58,7 @@ class ItemListView extends StatefulWidget {
this.selectedCollections,
this.selectedFiles,
this.viewType = ItemViewType.listView,
+ this.physics = const NeverScrollableScrollPhysics(),
});
@override
@@ -121,24 +123,19 @@ class _ItemListViewState extends State<ItemListView> {
}
Widget _buildListView() {
- return Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- ListView.separated(
- separatorBuilder: (context, index) => const SizedBox(height: 8),
- shrinkWrap: true,
- physics: const NeverScrollableScrollPhysics(),
- itemCount: _sortedItems.length,
- itemBuilder: (context, index) => _buildItem(index),
- ),
- ],
+ return ListView.separated(
+ separatorBuilder: (context, index) => const SizedBox(height: 8),
+ shrinkWrap: true,
+ physics: widget.physics,
+ itemCount: _sortedItems.length,
+ itemBuilder: (context, index) => _buildItem(index),
);
}
Widget _buildGridView() {
return GridView.builder(
shrinkWrap: true,
- physics: const NeverScrollableScrollPhysics(),
+ physics: widget.physics,
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 12,
diff --git a/mobile/apps/locker/lib/ui/pages/all_collections_page.dart b/mobile/apps/locker/lib/ui/pages/all_collections_page.dart
index 31aa2b444f..c003d3d604 100644
--- a/mobile/apps/locker/lib/ui/pages/all_collections_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/all_collections_page.dart
@@ -235,10 +235,11 @@ class _AllCollectionsPageState extends State<AllCollectionsPage> {
style: textTheme.smallMuted,
),
const SizedBox(height: 20),
- Flexible(
+ Expanded(
child: ItemListView(
collections: _sortedCollections,
selectedCollections: widget.selectedCollections,
+ physics: const BouncingScrollPhysics(),
),
),
if (_uncategorizedCollection != null && showUncategorized)
diff --git a/mobile/apps/locker/lib/ui/pages/collection_page.dart b/mobile/apps/locker/lib/ui/pages/collection_page.dart
index eac24c210b..0943ff6b61 100644
--- a/mobile/apps/locker/lib/ui/pages/collection_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/collection_page.dart
@@ -411,23 +411,26 @@ class _CollectionPageState extends UploaderPageState<CollectionPage>
],
),
),
- SingleChildScrollView(
- padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 16),
- child: _displayedFiles.isEmpty
- ? const Center(
- child: EmptyStateWidget(
- assetPath: 'assets/empty_state.png',
- title: "Nothing to see here",
- subtitle:
- "Upload files to this collection to see them here",
- showBorder: false,
+ Expanded(
+ child: Padding(
+ padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 16),
+ child: _displayedFiles.isEmpty
+ ? const Center(
+ child: EmptyStateWidget(
+ assetPath: 'assets/empty_state.png',
+ title: "Nothing to see here",
+ subtitle:
+ "Upload files to this collection to see them here",
+ showBorder: false,
+ ),
+ )
+ : ItemListView(
+ key: ValueKey(_displayedFiles.length),
+ files: _displayedFiles,
+ selectedFiles: _selectedFiles,
+ physics: const BouncingScrollPhysics(),
),
- )
- : ItemListView(
- key: ValueKey(_displayedFiles.length),
- files: _displayedFiles,
- selectedFiles: _selectedFiles,
- ),
+ ),
),
],
);
diff --git a/mobile/apps/locker/lib/ui/pages/trash_page.dart b/mobile/apps/locker/lib/ui/pages/trash_page.dart
index 1175a3c935..c869c3e7d0 100644
--- a/mobile/apps/locker/lib/ui/pages/trash_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/trash_page.dart
@@ -282,22 +282,10 @@ class _TrashPageState extends State<TrashPage> {
),
const SizedBox(height: 24),
Expanded(
- child: LayoutBuilder(
- builder: (context, constraints) {
- return SingleChildScrollView(
- physics: const BouncingScrollPhysics(),
- padding: EdgeInsets.zero,
- child: ConstrainedBox(
- constraints: BoxConstraints(
- minHeight: constraints.maxHeight,
- ),
- child: ItemListView(
- files: _sortedTrashFiles.cast<EnteFile>(),
- fileOverflowActions: _getFileOverflowActions(),
- ),
- ),
- );
- },
+ child: ItemListView(
+ files: _sortedTrashFiles.cast<EnteFile>(),
+ fileOverflowActions: _getFileOverflowActions(),
+ physics: const BouncingScrollPhysics(),
),
),
],