From 5143fce809f58beb8c5d7e070e8e8ce1fe554b27 Mon Sep 17 00:00:00 2001 From: Mustafa Ahmed Abduljabbar Date: Wed, 17 Jun 2020 00:20:56 +0300 Subject: [PATCH] - autoselect barcode reader.. --- example/lib/main.dart | 3 ++- lib/universal_barcode.dart | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index b2817b6..80c526e 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -33,7 +33,8 @@ class _MyHomePageState extends State { body: Column( children: [ UniversalBarcode( - (code){}, [BarcodeFormat.QR_CODE] + (code){}, [BarcodeFormat.QR_CODE], + autoselectBarcodeScanner: true, ), OutlineButton.icon( onPressed: () => UniversalBarcode.show( diff --git a/lib/universal_barcode.dart b/lib/universal_barcode.dart index ede927f..fd6bbe1 100644 --- a/lib/universal_barcode.dart +++ b/lib/universal_barcode.dart @@ -13,7 +13,8 @@ import 'package:universal_barcode/utils/debouncer.dart'; class UniversalBarcode extends StatefulWidget { final Function(String code) didCatchCode; final List lookupFormats; - UniversalBarcode(this.didCatchCode, this.lookupFormats); + final bool autoselectBarcodeScanner; + UniversalBarcode(this.didCatchCode, this.lookupFormats, {this.autoselectBarcodeScanner = false}); @override State createState() => _UniversalBarcodeState(); @@ -80,6 +81,7 @@ class _UniversalBarcodeState extends State { void initState() { super.initState(); barcodeFocusNode = FocusNode(); + keyboardMode = widget.autoselectBarcodeScanner; } @override