ashilkn vor 3 Jahren
Ursprung
Commit
9109ee46cb

+ 4 - 4
lib/services/search_service.dart

@@ -22,7 +22,7 @@ class SearchService {
   final _config = Configuration.instance;
   final _logger = Logger((UserService).toString());
   final _collectionService = CollectionsService.instance;
-  static const _kMaximumResultsLimit = 20;
+  static const _maximumResultsLimit = 20;
 
   SearchService._privateConstructor();
   static final SearchService instance = SearchService._privateConstructor();
@@ -64,7 +64,7 @@ class SearchService {
     final List<File> matchedFiles = [];
     final List<File> files = await getAllFiles();
     for (int i = 0;
-        (i < files.length) && (matchedFiles.length < _kMaximumResultsLimit);
+        (i < files.length) && (matchedFiles.length < _maximumResultsLimit);
         i++) {
       File file = files[i];
       if (file.title.contains(RegExp(query, caseSensitive: false))) {
@@ -163,9 +163,9 @@ class SearchService {
         )
         .toList();
     final List<CollectionWithThumbnail> result = [];
-    final limit = matchedCollection.length < _kMaximumResultsLimit
+    final limit = matchedCollection.length < _maximumResultsLimit
         ? matchedCollection.length
-        : _kMaximumResultsLimit;
+        : _maximumResultsLimit;
     for (int i = 0; i < limit; i++) {
       Collection collection = matchedCollection[i];
       result.add(

+ 5 - 8
lib/ui/viewer/search/collections/files_in_location_page.dart

@@ -11,16 +11,13 @@ import 'package:photos/ui/viewer/gallery/gallery_overlay_widget.dart';
 
 class FilesInLocationPage extends StatelessWidget {
   final LocationSearchResult locationSearchResult;
-  final String tagPrefix;
-  final GalleryType appBarType;
-  final GalleryType overlayType;
-  final _selectedFiles = SelectedFiles();
 
+  final _selectedFiles = SelectedFiles();
+  static const String kTagPrefix = "location_search";
+  static const GalleryType appBarType = GalleryType.searchResults;
+  static const GalleryType overlayType = GalleryType.searchResults;
   FilesInLocationPage({
     this.locationSearchResult,
-    this.tagPrefix = "location_search",
-    this.appBarType = GalleryType.searchResults,
-    this.overlayType = GalleryType.searchResults,
     Key key,
   }) : super(key: key);
 
@@ -60,7 +57,7 @@ class FilesInLocationPage extends StatelessWidget {
                   null,
             ),
       ],
-      tagPrefix: tagPrefix,
+      tagPrefix: kTagPrefix,
       selectedFiles: _selectedFiles,
       initialFiles: [locationSearchResult.files[0]],
       footer: const SizedBox(height: 120),

+ 2 - 2
lib/ui/viewer/search/search_suggestions.dart

@@ -51,10 +51,10 @@ class SearchSuggestionsWidget extends StatelessWidget {
                 final result = results[index];
                 if (result is AlbumSearchResult) {
                   return AlbumSearchResultWidget(result);
-                } else if (result is FileSearchResult) {
-                  return FileSearchResultWidget(result);
                 } else if (result is LocationSearchResult) {
                   return LocationSearchResultWidget(result);
+                } else if (result is FileSearchResult) {
+                  return FileSearchResultWidget(result);
                 } else {
                   Logger('SearchSuggestionsWidget')
                       .info("Invalid/Unsupported value");