[photos][mob] Trim whitespace from search query (#6153)

## Description

Previously, when searching for e.g. `test ` would not find an album
called `test`. That's because the trailing whitespace is not ignored. On
mobile this can be especially annoying because sometimes auto-completion
automatically inserts whitespace after a word.

This patch trims whitespace of the search query in two places:
* When searching for an album name when moving photos to an album.
* When using the global search.

## Tests
This commit is contained in:
Neeraj
2025-06-04 10:52:40 +05:30
committed by GitHub
2 changed files with 2 additions and 2 deletions

View File

@@ -170,7 +170,7 @@ class _CollectionActionSheetState extends State<CollectionActionSheet> {
prefixIcon: Icons.search_rounded,
onChange: (value) {
setState(() {
_searchQuery = value;
_searchQuery = value.trim();
});
},
isClearable: true,

View File

@@ -114,7 +114,7 @@ class SearchWidgetState extends State<SearchWidget> {
isLoading.value = true;
_debouncer.run(() async {
if (mounted) {
query = textController.text;
query = textController.text.trim();
IndexOfStackNotifier().isSearchQueryEmpty = query.isEmpty;
searchResultsStreamNotifier.value =
_getSearchResultsStream(context, query);