From 9cba3e037ca459596827f355c8228c1e5822407e Mon Sep 17 00:00:00 2001 From: Felix Date: Mon, 12 Aug 2019 10:42:17 +0100 Subject: [PATCH] safer code --- lib/common/widgets/organisations_dialog.dart | 3 ++- lib/pages/receipt_page_2.dart | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/common/widgets/organisations_dialog.dart b/lib/common/widgets/organisations_dialog.dart index 2134fb7..9c265c3 100644 --- a/lib/common/widgets/organisations_dialog.dart +++ b/lib/common/widgets/organisations_dialog.dart @@ -23,7 +23,8 @@ class FindOrganisations { TextEditingController searchBarText = new TextEditingController(); var organisations = new Organisations(); var listTitle = "All Organisations"; - var organisationsList = organisations.getTestData(); +// var organisationsList = organisations.getTestData(); + var organisationsList = List(); Future _submitSearch(String search) async { _searchEnabled = false; diff --git a/lib/pages/receipt_page_2.dart b/lib/pages/receipt_page_2.dart index 7f45d6e..2bee870 100644 --- a/lib/pages/receipt_page_2.dart +++ b/lib/pages/receipt_page_2.dart @@ -150,8 +150,11 @@ class ReceiptPage2State extends State { var organisations = new FindOrganisations(); var orgDialog = organisations.dialog(context); orgDialog.then((organisation) { - setState(() => {}); - debugPrint(organisation.name); + try { + debugPrint(organisation.name); + } catch(_) { + debugPrint("No organisation chosen."); + } }); }, child: Text(