fixed search when using the query bar

This commit is contained in:
Thibault Deckers 2023-03-17 19:54:16 +01:00
parent 298637a3c6
commit 8513da9c15
2 changed files with 13 additions and 6 deletions

View file

@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file.
### Fixed ### Fixed
- Viewer: playing video from app content provider - Viewer: playing video from app content provider
- Search: using the query bar yields a black screen
## <a id="v1.8.3"></a>[v1.8.3] - 2023-03-13 ## <a id="v1.8.3"></a>[v1.8.3] - 2023-03-13

View file

@ -272,14 +272,20 @@ class CollectionSearchDelegate extends AvesSearchDelegate with FeedbackMixin, Va
); );
} }
var _selectingFromQuery = false;
@override @override
Widget buildResults(BuildContext context) { Widget buildResults(BuildContext context) {
WidgetsBinding.instance.addPostFrameCallback((_) { // guard against multiple build calls
// `buildResults` is called in the build phase, if (!_selectingFromQuery) {
// so we post the call that will filter the collection _selectingFromQuery = true;
// and possibly trigger a rebuild here WidgetsBinding.instance.addPostFrameCallback((_) {
_select(context, _buildQueryFilter(true)); // `buildResults` is called in the build phase,
}); // so we post the call that will filter the collection
// and possibly trigger a rebuild here
_select(context, _buildQueryFilter(true));
});
}
return const SizedBox(); return const SizedBox();
} }