π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
use IndexedStack to preserve state of all search sections screen when searching
ashilknafef0db1fdd4
diff --git a/lib/ui/search_tab.dart b/lib/ui/search_tab.dartindex 6f4e317346..1e032b5203 100644--- a/lib/ui/search_tab.dart+++ b/lib/ui/search_tab.dart@@ -20,22 +20,35 @@ class SearchTab extends StatefulWidget {class _SearchTabState extends State<SearchTab> {// Focus nodes are necessaryvar _searchResults = <SearchResult>[];+ int index = 0;@overridevoid didChangeDependencies() {super.didChangeDependencies();_searchResults = InheritedSearchResults.of(context).results;+ if (_searchResults.isEmpty) {+ if (isSearchQueryEmpty) {+ index = 0;+ } else {+ index = 2;+ }+ } else {+ index = 1;+ }}@overrideWidget build(BuildContext context) {return Padding(padding: const EdgeInsets.only(top: 8),- child: _searchResults.isEmpty- ? isSearchQueryEmpty- ? const AllSearchSections()- : const NoResultWidget()- : SearchSuggestionsWidget(_searchResults),+ child: IndexedStack(+ index: index,+ children: [+ const AllSearchSections(),+ SearchSuggestionsWidget(_searchResults),+ const NoResultWidget(),+ ],+ ),);}}