From f75aa4ca0edb44e76e8a4a1e6a6dc5bcd3c446f7 Mon Sep 17 00:00:00 2001 From: Oliver Date: Sun, 3 Oct 2021 11:41:16 +1100 Subject: [PATCH] Update form field with scanned barcode --- lib/api_form.dart | 4 ++-- lib/barcode.dart | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/api_form.dart b/lib/api_form.dart index 74c62ff6..1a7237f6 100644 --- a/lib/api_form.dart +++ b/lib/api_form.dart @@ -332,9 +332,9 @@ class APIFormField { trailing: IconButton( icon: FaIcon(FontAwesomeIcons.qrcode), onPressed: () async { - var handler = UniqueBarcodeHandler((String hash) { - print("Scanned barcode: " + hash); + controller.text = hash; + data["value"] = hash; }); Navigator.push( diff --git a/lib/barcode.dart b/lib/barcode.dart index de6283f0..76bb4fe2 100644 --- a/lib/barcode.dart +++ b/lib/barcode.dart @@ -511,9 +511,16 @@ class UniqueBarcodeHandler extends BarcodeHandler { ); } else { + successTone(); + // Close the barcode scanner Navigator.of(context).pop(); + showSnackIcon( + L10().barcodeAssigned, + success: true + ); + callback(hash); } }