async organisations dialog works now
This commit is contained in:
parent
fa481f839d
commit
679fbd2f97
1 changed files with 11 additions and 8 deletions
|
@ -25,17 +25,18 @@ class FindOrganisations {
|
||||||
var listTitle = "All Organisations";
|
var listTitle = "All Organisations";
|
||||||
var organisationsList = organisations.getTestData();
|
var organisationsList = organisations.getTestData();
|
||||||
|
|
||||||
void _submitSearch(String search) async {
|
Future<int> _submitSearch(String search) async {
|
||||||
_searchEnabled = false;
|
_searchEnabled = false;
|
||||||
listTitle = "Results for \'" + search + "\'";
|
listTitle = "Results for \'" + search + "\'";
|
||||||
|
|
||||||
var futureOrgs = organisations.findOrganisations(search);
|
var futureOrgs = await organisations.findOrganisations(search);
|
||||||
futureOrgs.then((value) {
|
// futureOrgs.then((value) {
|
||||||
debugPrint("There are " + value.length.toString() +
|
debugPrint("There are " + futureOrgs.length.toString() +
|
||||||
" payees matching the query \'" + search + "\'.");
|
" payees matching the query \'" + search + "\'.");
|
||||||
organisationsList = value;
|
organisationsList = futureOrgs;
|
||||||
_searchEnabled = true;
|
_searchEnabled = true;
|
||||||
});
|
return futureOrgs.length;
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
return showDialog<Organisation>(
|
return showDialog<Organisation>(
|
||||||
|
@ -69,8 +70,10 @@ class FindOrganisations {
|
||||||
},
|
},
|
||||||
onSubmitted: (value) {
|
onSubmitted: (value) {
|
||||||
if (_searchEnabled) {
|
if (_searchEnabled) {
|
||||||
_submitSearch(searchBarText.text);
|
var result = _submitSearch(searchBarText.text);
|
||||||
setState(() => {});
|
result.then((_) {
|
||||||
|
setState(() {});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
Reference in a new issue