Skip to content

armgit / ente

Public Imported from GitHub
0

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

remove redundant const variable

ashilkn7d6a2efd065f
diff --git a/lib/core/constants.dart b/lib/core/constants.dart
index 5c70e218f0..2863e9a55c 100644
--- a/lib/core/constants.dart
+++ b/lib/core/constants.dart
@@ -65,6 +65,6 @@ const defaultCityRadius = 10.0;
const galleryGridSpacing = 2.0;
-const searchSectionLimit = 7;
+const kSearchSectionLimit = 7;
bool isInternalUser = false;
diff --git a/lib/models/search/recent_searches.dart b/lib/models/search/recent_searches.dart
index 40deb68ec0..2c31f86b03 100644
--- a/lib/models/search/recent_searches.dart
+++ b/lib/models/search/recent_searches.dart
@@ -12,7 +12,7 @@ class RecentSearches with ChangeNotifier {
void add(String query) {
searches.add(query);
- while (searches.length > searchSectionLimit) {
+ while (searches.length > kSearchSectionLimit) {
searches.remove(searches.first);
}
//buffer for not surfacing a new recent search before going to the next
diff --git a/lib/states/all_sections_examples_state.dart b/lib/states/all_sections_examples_state.dart
index c6215c6214..fdeb6fcdf4 100644
--- a/lib/states/all_sections_examples_state.dart
+++ b/lib/states/all_sections_examples_state.dart
@@ -84,7 +84,7 @@ class _AllSectionsExamplesProviderState
continue;
}
allSectionsExamples.add(
- sectionType.getData(context, limit: searchSectionLimit),
+ sectionType.getData(context, limit: kSearchSectionLimit),
);
}
allSectionsExamplesFuture =
diff --git a/lib/ui/viewer/search/search_section.dart b/lib/ui/viewer/search/search_section.dart
index 515590dbc0..1cae1b3fab 100644
--- a/lib/ui/viewer/search/search_section.dart
+++ b/lib/ui/viewer/search/search_section.dart
@@ -50,7 +50,7 @@ class _SearchSectionState extends State<SearchSection> {
stream.listen((event) async {
_examples = await widget.sectionType.getData(
context,
- limit: searchSectionLimit,
+ limit: kSearchSectionLimit,
);
setState(() {});
}),
diff --git a/lib/ui/viewer/search_tab/albums_section.dart b/lib/ui/viewer/search_tab/albums_section.dart
index db80e04c0d..2ad9f4b942 100644
--- a/lib/ui/viewer/search_tab/albums_section.dart
+++ b/lib/ui/viewer/search_tab/albums_section.dart
@@ -15,7 +15,6 @@ import "package:photos/ui/viewer/file/no_thumbnail_widget.dart";
import "package:photos/ui/viewer/file/thumbnail_widget.dart";
import "package:photos/ui/viewer/gallery/collection_page.dart";
import "package:photos/ui/viewer/search/search_section_cta.dart";
-import "package:photos/ui/viewer/search_tab/search_tab.dart";
import "package:photos/ui/viewer/search_tab/section_header.dart";
import "package:photos/utils/navigation_util.dart";
@@ -110,8 +109,7 @@ class _AlbumsSectionState extends State<AlbumsSection> {
children: [
SectionHeader(
SectionType.album,
- hasMore:
- (_albumSearchResults.length >= SearchTab.hasMoreThreshold),
+ hasMore: (_albumSearchResults.length >= kSearchSectionLimit - 1),
),
const SizedBox(height: 2),
SizedBox(
diff --git a/lib/ui/viewer/search_tab/search_tab.dart b/lib/ui/viewer/search_tab/search_tab.dart
index 075c62e0dc..b12bf7e40e 100644
--- a/lib/ui/viewer/search_tab/search_tab.dart
+++ b/lib/ui/viewer/search_tab/search_tab.dart
@@ -14,7 +14,6 @@ import "package:photos/ui/viewer/search/tab_empty_state.dart";
import 'package:photos/ui/viewer/search_tab/albums_section.dart';
class SearchTab extends StatefulWidget {
- static const hasMoreThreshold = 6;
const SearchTab({Key? key}) : super(key: key);
@override
@@ -106,7 +105,7 @@ class _AllSearchSectionsState extends State<AllSearchSections> {
return SearchSection(
sectionType: searchTypes[index],
examples: snapshot.data!.elementAt(index),
- limit: searchSectionLimit,
+ limit: kSearchSectionLimit,
);
}
},