fix: Show search bar during loading of selector views

This commit is contained in:
Alberto Ponces
2022-09-12 00:36:18 +01:00
parent 6665095b2e
commit d01e7fdcc2
2 changed files with 53 additions and 53 deletions

View File

@ -35,29 +35,29 @@ class _AppSelectorViewState extends State<AppSelectorView> {
child: Padding( child: Padding(
padding: padding:
const EdgeInsets.symmetric(vertical: 4.0, horizontal: 12.0), const EdgeInsets.symmetric(vertical: 4.0, horizontal: 12.0),
child: model.noApps child: Column(
? Center( children: <Widget>[
child: I18nText('appSelectorCard.noAppsLabel'), SearchBar(
) showSelectIcon: false,
: model.apps.isEmpty hintText: FlutterI18n.translate(
? const AppSkeletonLoader() context,
: Column( 'appSelectorView.searchBarHint',
children: <Widget>[ ),
SearchBar( onQueryChanged: (searchQuery) {
showSelectIcon: false, setState(() {
hintText: FlutterI18n.translate( _query = searchQuery;
context, });
'appSelectorView.searchBarHint', },
), ),
onQueryChanged: (searchQuery) { const SizedBox(height: 12),
setState(() { Expanded(
_query = searchQuery; child: model.noApps
}); ? Center(
}, child: I18nText('appSelectorCard.noAppsLabel'),
), )
const SizedBox(height: 12), : model.apps.isEmpty
Expanded( ? const AppSkeletonLoader()
child: ListView( : ListView(
padding: const EdgeInsets.only(bottom: 80), padding: const EdgeInsets.only(bottom: 80),
children: model children: model
.getFilteredApps(_query) .getFilteredApps(_query)
@ -74,9 +74,9 @@ class _AppSelectorViewState extends State<AppSelectorView> {
)) ))
.toList(), .toList(),
), ),
), ),
], ],
), ),
), ),
), ),
), ),

View File

@ -37,30 +37,30 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
child: Padding( child: Padding(
padding: padding:
const EdgeInsets.symmetric(vertical: 4.0, horizontal: 12.0), const EdgeInsets.symmetric(vertical: 4.0, horizontal: 12.0),
child: model.patches.isEmpty child: Column(
? Center( children: <Widget>[
child: CircularProgressIndicator( SearchBar(
color: Theme.of(context).colorScheme.primary, showSelectIcon: true,
), hintText: FlutterI18n.translate(
) context,
: Column( 'patchesSelectorView.searchBarHint',
children: <Widget>[ ),
SearchBar( onQueryChanged: (searchQuery) {
showSelectIcon: true, setState(() {
hintText: FlutterI18n.translate( _query = searchQuery;
context, });
'patchesSelectorView.searchBarHint', },
), onSelectAll: (value) => model.selectAllPatches(value),
onQueryChanged: (searchQuery) { ),
setState(() { const SizedBox(height: 12),
_query = searchQuery; Expanded(
}); child: model.patches.isEmpty
}, ? Center(
onSelectAll: (value) => model.selectAllPatches(value), child: CircularProgressIndicator(
), color: Theme.of(context).colorScheme.primary,
const SizedBox(height: 12), ),
Expanded( )
child: ListView( : ListView(
padding: const EdgeInsets.only(bottom: 80), padding: const EdgeInsets.only(bottom: 80),
children: model children: model
.getQueriedPatches(_query) .getQueriedPatches(_query)
@ -160,9 +160,9 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
) )
.toList(), .toList(),
), ),
), ),
], ],
), ),
), ),
), ),
), ),