forked from yaso_meth/mih-project
add scanner back
This commit is contained in:
@@ -14,6 +14,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart';
|
||||
import 'package:mobile_scanner/mobile_scanner.dart';
|
||||
import 'package:simple_barcode_scanner/simple_barcode_scanner.dart';
|
||||
|
||||
class LoyaltyCards extends StatefulWidget {
|
||||
final AppUser signedInUser;
|
||||
@@ -142,48 +143,49 @@ class _LoyaltyCardsState extends State<LoyaltyCards> {
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
MIHButton(
|
||||
onTap: () async {
|
||||
String bcodeScanResults;
|
||||
try {
|
||||
bcodeScanResults = await FlutterBarcodeScanner.scanBarcode(
|
||||
'#ff6666',
|
||||
'Cancel',
|
||||
true,
|
||||
ScanMode.BARCODE,
|
||||
);
|
||||
} on PlatformException {
|
||||
bcodeScanResults = "Platform not supported";
|
||||
}
|
||||
onTap:
|
||||
// () async {
|
||||
// String bcodeScanResults;
|
||||
// try {
|
||||
// bcodeScanResults = await FlutterBarcodeScanner.scanBarcode(
|
||||
// '#ff6666',
|
||||
// 'Cancel',
|
||||
// true,
|
||||
// ScanMode.BARCODE,
|
||||
// );
|
||||
// } on PlatformException {
|
||||
// bcodeScanResults = "Platform not supported";
|
||||
// }
|
||||
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
cardNumberController.text = bcodeScanResults;
|
||||
});
|
||||
// if (!mounted) return;
|
||||
// setState(() {
|
||||
// cardNumberController.text = bcodeScanResults;
|
||||
// });
|
||||
// },
|
||||
// () {
|
||||
// openscanner();
|
||||
// },
|
||||
() async {
|
||||
print("here");
|
||||
String? res = await SimpleBarcodeScanner.scanBarcode(
|
||||
context,
|
||||
barcodeAppBar: const BarcodeAppBar(
|
||||
appBarTitle: 'Scan Bardcode',
|
||||
centerTitle: true,
|
||||
enableBackButton: true,
|
||||
backButtonIcon: Icon(Icons.arrow_back),
|
||||
),
|
||||
isShowFlashIcon: true,
|
||||
delayMillis: 500,
|
||||
cameraFace: CameraFace.back,
|
||||
scanFormat: ScanFormat.ONLY_BARCODE,
|
||||
);
|
||||
if (res != null) {
|
||||
setState(() {
|
||||
cardNumberController.text = res;
|
||||
});
|
||||
}
|
||||
},
|
||||
// () {
|
||||
// openscanner();
|
||||
// },
|
||||
// () async {
|
||||
// print("here");
|
||||
// String? res = await SimpleBarcodeScanner.scanBarcode(
|
||||
// context,
|
||||
// barcodeAppBar: const BarcodeAppBar(
|
||||
// appBarTitle: 'Scan Bardcode',
|
||||
// centerTitle: true,
|
||||
// enableBackButton: true,
|
||||
// backButtonIcon: Icon(Icons.arrow_back),
|
||||
// ),
|
||||
// isShowFlashIcon: true,
|
||||
// delayMillis: 500,
|
||||
// cameraFace: CameraFace.back,
|
||||
// scanFormat: ScanFormat.ONLY_BARCODE,
|
||||
// );
|
||||
// if (res != null) {
|
||||
// setState(() {
|
||||
// cardNumberController.text = res;
|
||||
// });
|
||||
// }
|
||||
// },
|
||||
buttonText: "Scan",
|
||||
buttonColor:
|
||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||
|
||||
Reference in New Issue
Block a user