Browse Source

minor changes

ashilkn 2 years ago
parent
commit
1b9b5bc511

+ 21 - 16
lib/services/search_service.dart

@@ -176,16 +176,17 @@ class SearchService {
 
     for (var holiday in allHolidays) {
       if (holiday.name.contains(nonCaseSensitiveRegexForQuery)) {
-        holidaySearchResults.add(
-          HolidaySearchResult(
-            holiday.name,
+        final matchedFiles =
             await FilesDB.instance.getFilesCreatedWithinDurations(
-              _getDurationsOfHolidayInEveryYear(holiday.day, holiday.month),
-              null,
-              order: 'DESC',
-            ),
-          ),
+          _getDurationsOfHolidayInEveryYear(holiday.day, holiday.month),
+          null,
+          order: 'DESC',
         );
+        if (matchedFiles.isNotEmpty) {
+          holidaySearchResults.add(
+            HolidaySearchResult(holiday.name, matchedFiles),
+          );
+        }
       }
     }
     return holidaySearchResults;
@@ -197,16 +198,20 @@ class SearchService {
 
     for (var month in allMonths) {
       if (month.name.startsWith(nonCaseSensitiveRegexForQuery)) {
-        monthSearchResults.add(
-          MonthSearchResult(
-            month.name,
+        final matchedFiles =
             await FilesDB.instance.getFilesCreatedWithinDurations(
-              _getDurationsOfMonthInEveryYear(month.monthNumber),
-              null,
-              order: 'DESC',
-            ),
-          ),
+          _getDurationsOfMonthInEveryYear(month.monthNumber),
+          null,
+          order: 'DESC',
         );
+        if (matchedFiles.isNotEmpty) {
+          monthSearchResults.add(
+            MonthSearchResult(
+              month.name,
+              matchedFiles,
+            ),
+          );
+        }
       }
     }
 

+ 2 - 2
lib/ui/viewer/search/search_result_widgets/no_result_widget.dart

@@ -43,7 +43,7 @@ class NoResultWidget extends StatelessWidget {
               child: Text(
                 "You can try searching for a different query.",
                 style: TextStyle(
-                  fontSize: 16,
+                  fontSize: 14,
                   color: Theme.of(context)
                       .colorScheme
                       .defaultTextColor
@@ -60,7 +60,7 @@ class NoResultWidget extends StatelessWidget {
 \u2022 Holidays (e.g. "Christmas")
 \u2022 Album names (e.g. "Recents")''',
                 style: TextStyle(
-                  fontSize: 16,
+                  fontSize: 14,
                   color: Theme.of(context)
                       .colorScheme
                       .defaultTextColor

+ 3 - 3
lib/ui/viewer/search/search_suffix_icon_widget.dart

@@ -2,8 +2,8 @@ import 'package:flutter/material.dart';
 import 'package:photos/ente_theme_data.dart';
 
 class SearchSuffixIcon extends StatefulWidget {
-  final bool isDebouncing;
-  const SearchSuffixIcon(this.isDebouncing, {Key key}) : super(key: key);
+  final bool shouldShowSpinner;
+  const SearchSuffixIcon(this.shouldShowSpinner, {Key key}) : super(key: key);
 
   @override
   State<SearchSuffixIcon> createState() => _SearchSuffixIconState();
@@ -15,7 +15,7 @@ class _SearchSuffixIconState extends State<SearchSuffixIcon>
   Widget build(BuildContext context) {
     return AnimatedSwitcher(
       duration: const Duration(milliseconds: 175),
-      child: widget.isDebouncing
+      child: widget.shouldShowSpinner
           ? Padding(
               padding: const EdgeInsets.all(12),
               child: SizedBox(

+ 1 - 3
lib/utils/debouncer.dart

@@ -26,9 +26,7 @@ class Debouncer {
     }
   }
 
-  bool isActive() {
-    return _debounceTimer != null && _debounceTimer.isActive;
-  }
+  bool isActive() => _debounceTimer != null && _debounceTimer.isActive;
 
   ValueNotifier<bool> get debounceActiveNotifier {
     return _debounceActiveNotifier;

+ 1 - 1
pubspec.yaml

@@ -11,7 +11,7 @@ description: ente photos application
 # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
 # Read more about iOS versioning at
 # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
-version: 0.6.24+354
+version: 0.6.25+355
 
 environment:
   sdk: ">=2.10.0 <3.0.0"