new organisation picker -actually- works now

This commit is contained in:
Felix 2019-08-12 10:48:50 +01:00
parent 9cba3e037c
commit ee682eef82
2 changed files with 11 additions and 5 deletions

View File

@ -32,8 +32,8 @@ class FindOrganisations {
var futureOrgs = await organisations.findOrganisations(search);
// futureOrgs.then((value) {
debugPrint("There are " + futureOrgs.length.toString() +
" payees matching the query \'" + search + "\'.");
// debugPrint("There are " + futureOrgs.length.toString() +
// " payees matching the query \'" + search + "\'.");
organisationsList = futureOrgs;
_searchEnabled = true;
return futureOrgs.length;
@ -41,7 +41,7 @@ class FindOrganisations {
}
_chosenOrg(Organisation chosen) {
debugPrint(chosen.name + " tapped");
// debugPrint(chosen.name + " tapped");
}
return showDialog<Organisation>(
@ -139,6 +139,7 @@ class FindOrganisations {
// trailing: Icon(Icons.arrow_forward_ios),
// onTap: _chosenOrg(organisationsList[index]),
onTap: (){
Navigator.of(context).pop(organisationsList[index]);
_chosenOrg(organisationsList[index]);
},
onLongPress: (){

View File

@ -151,7 +151,10 @@ class ReceiptPage2State extends State<ReceiptPage2> {
var orgDialog = organisations.dialog(context);
orgDialog.then((organisation) {
try {
debugPrint(organisation.name);
organisation.name.length;
transaction.organisation = organisation;
// debugPrint(organisation.name);
setState(() {});
} catch(_) {
debugPrint("No organisation chosen.");
}
@ -160,7 +163,9 @@ class ReceiptPage2State extends State<ReceiptPage2> {
child: Text(
transaction.organisation.name == null
? 'Find'
: transaction.organisation.name,
: transaction.organisation.name.length > 14
? transaction.organisation.name.substring(0,12) + "..."
: transaction.organisation.name,
style:
TextStyle(color: Colors.white, fontSize: 18.0),
),