Skip to content

Commit

Permalink
- autoselect barcode reader..
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafa96m committed Jun 16, 2020
1 parent 1aef2c5 commit 5143fce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class _MyHomePageState extends State<MyHomePage> {
body: Column(
children: [
UniversalBarcode(
(code){}, [BarcodeFormat.QR_CODE]
(code){}, [BarcodeFormat.QR_CODE],
autoselectBarcodeScanner: true,
),
OutlineButton.icon(
onPressed: () => UniversalBarcode.show(
Expand Down
4 changes: 3 additions & 1 deletion lib/universal_barcode.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import 'package:universal_barcode/utils/debouncer.dart';
class UniversalBarcode extends StatefulWidget {
final Function(String code) didCatchCode;
final List<BarcodeFormat> lookupFormats;
UniversalBarcode(this.didCatchCode, this.lookupFormats);
final bool autoselectBarcodeScanner;
UniversalBarcode(this.didCatchCode, this.lookupFormats, {this.autoselectBarcodeScanner = false});

@override
State<StatefulWidget> createState() => _UniversalBarcodeState();
Expand Down Expand Up @@ -80,6 +81,7 @@ class _UniversalBarcodeState extends State<UniversalBarcode> {
void initState() {
super.initState();
barcodeFocusNode = FocusNode();
keyboardMode = widget.autoselectBarcodeScanner;
}

@override
Expand Down

0 comments on commit 5143fce

Please sign in to comment.