From ee682eef82a4916323ea336e6279388ee038e27a Mon Sep 17 00:00:00 2001 From: Felix Date: Mon, 12 Aug 2019 10:48:50 +0100 Subject: [PATCH] new organisation picker -actually- works now --- lib/common/widgets/organisations_dialog.dart | 7 ++++--- lib/pages/receipt_page_2.dart | 9 +++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/common/widgets/organisations_dialog.dart b/lib/common/widgets/organisations_dialog.dart index 9c265c3..94e4180 100644 --- a/lib/common/widgets/organisations_dialog.dart +++ b/lib/common/widgets/organisations_dialog.dart @@ -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( @@ -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: (){ diff --git a/lib/pages/receipt_page_2.dart b/lib/pages/receipt_page_2.dart index 2bee870..1cce097 100644 --- a/lib/pages/receipt_page_2.dart +++ b/lib/pages/receipt_page_2.dart @@ -151,7 +151,10 @@ class ReceiptPage2State extends State { 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 { 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), ),