Skip to content

armgit / ente

Public Imported from GitHub
0

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

Simplify search result bottom spacing

ashilkn837ed31c2084
diff --git a/mobile/apps/photos/changes/search-results-bottom-spacing.md b/mobile/apps/photos/changes/search-results-bottom-spacing.md
new file mode 100644
index 0000000000..8cd169bbaf
--- /dev/null
+++ b/mobile/apps/photos/changes/search-results-bottom-spacing.md
@@ -0,0 +1 @@
+- Removed extra keyboard-driven bottom spacing from Photos search results.
diff --git a/mobile/apps/photos/lib/ui/tabs/albums_tab.dart b/mobile/apps/photos/lib/ui/tabs/albums_tab.dart
index ffaca6c1fd..35c2523833 100644
--- a/mobile/apps/photos/lib/ui/tabs/albums_tab.dart
+++ b/mobile/apps/photos/lib/ui/tabs/albums_tab.dart
@@ -64,6 +64,7 @@ class _AlbumsTabState extends State<AlbumsTab>
static const Duration _kContentTransitionDuration = Duration(
milliseconds: 150,
);
+ static const double _kContentBottomPadding = 200;
final ValueNotifier<_AlbumsFilter> _filter = ValueNotifier(
_AlbumsFilter.ente,
@@ -238,13 +239,6 @@ class _AlbumsTabState extends State<AlbumsTab>
bool get _hasSearchQuery => _searchQuery.trim().isNotEmpty;
- double _keyboardAwareBottomPadding(double defaultPadding) {
- final keyboardInset = MediaQuery.viewInsetsOf(context).bottom;
- if (keyboardInset <= 0) return defaultPadding;
- final keyboardPadding = keyboardInset + 50.0;
- return keyboardPadding > defaultPadding ? keyboardPadding : defaultPadding;
- }
-
void _syncSortState() {
_sortKey.value = localSettings.albumSortKey();
_sortDirection.value = localSettings.albumSortDirection();
@@ -356,7 +350,6 @@ class _AlbumsTabState extends State<AlbumsTab>
required bool showCreateAlbum,
required Widget emptyState,
Widget? leadingSliver,
- double? bottomPadding,
}) {
if (collections.isEmpty && _searchQuery.trim().isEmpty) {
return SliverFillRemaining(hasScrollBody: false, child: emptyState);
@@ -374,7 +367,7 @@ class _AlbumsTabState extends State<AlbumsTab>
shrinkWrap: true,
shouldShowCreateAlbum: showCreateAlbum && !_hasSearchQuery,
enableSelectionMode: !_isSearchActive,
- bottomPadding: bottomPadding ?? 200,
+ bottomPadding: _kContentBottomPadding,
),
],
);
@@ -469,7 +462,6 @@ class _AlbumsTabState extends State<AlbumsTab>
}
Widget _buildGlobalSearchResultsSliver(AppLocalizations strings) {
- final bottomPadding = _keyboardAwareBottomPadding(200);
if (_isLocalGalleryMode) {
return SliverMainAxisGroup(
slivers: [
@@ -485,7 +477,9 @@ class _AlbumsTabState extends State<AlbumsTab>
sectionHeader: _buildSearchSectionHeader(strings.onDevice),
emptyStateSliver: _buildGlobalSearchEmptyStateSliver(strings),
),
- SliverToBoxAdapter(child: SizedBox(height: bottomPadding)),
+ const SliverToBoxAdapter(
+ child: SizedBox(height: _kContentBottomPadding),
+ ),
],
);
}
@@ -532,7 +526,9 @@ class _AlbumsTabState extends State<AlbumsTab>
tag: "album_search_shared",
collections: filteredSharedCollections,
),
- SliverToBoxAdapter(child: SizedBox(height: bottomPadding)),
+ const SliverToBoxAdapter(
+ child: SizedBox(height: _kContentBottomPadding),
+ ),
],
);
}
@@ -560,7 +556,7 @@ class _AlbumsTabState extends State<AlbumsTab>
albumViewType: _viewType.value,
sortKey: _sortKey.value,
sortDirection: _sortDirection.value,
- bottomPadding: _keyboardAwareBottomPadding(200),
+ bottomPadding: _kContentBottomPadding,
);
}
if (collections == null) {
@@ -575,7 +571,6 @@ class _AlbumsTabState extends State<AlbumsTab>
collections: collections,
showCreateAlbum: showCreateAlbum,
emptyState: emptyState,
- bottomPadding: _keyboardAwareBottomPadding(200),
leadingSliver: filter == _AlbumsFilter.ente && !_hasSearchQuery
? SliverToBoxAdapter(child: _buildDeleteEmptyAlbumsActionSlot())
: null,
diff --git a/mobile/apps/photos/lib/ui/viewer/search/result/no_result_widget.dart b/mobile/apps/photos/lib/ui/viewer/search/result/no_result_widget.dart
index 704373f203..293ed60181 100644
--- a/mobile/apps/photos/lib/ui/viewer/search/result/no_result_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/result/no_result_widget.dart
@@ -58,8 +58,7 @@ class _NoResultWidgetState extends State<NoResultWidget> {
@override
Widget build(BuildContext context) {
final textTheme = getEnteTextTheme(context);
- final keyboardInset = MediaQuery.viewInsetsOf(context).bottom;
- final bottomPadding = keyboardInset + (keyboardInset > 0 ? 50 : 0);
+ const bottomPadding = 124.0;
final searchTypeAndSuggestion = <Widget>[];
searchTypeToQuerySuggestion.forEach((key, value) {
searchTypeAndSuggestion.add(
@@ -83,7 +82,7 @@ class _NoResultWidgetState extends State<NoResultWidget> {
body: SingleChildScrollView(
physics: const BouncingScrollPhysics(),
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
- padding: EdgeInsets.fromLTRB(12, 8, 12, bottomPadding),
+ padding: const EdgeInsets.fromLTRB(12, 8, 12, bottomPadding),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [