scanner impliment
This commit is contained in:
@@ -10,6 +10,7 @@ import 'package:Mzansi_Innovation_Hub/mih_objects/loyalty_card.dart';
|
|||||||
import 'package:Mzansi_Innovation_Hub/mih_packages/mzansi_wallet/builder/build_loyalty_card_list.dart';
|
import 'package:Mzansi_Innovation_Hub/mih_packages/mzansi_wallet/builder/build_loyalty_card_list.dart';
|
||||||
import 'package:Mzansi_Innovation_Hub/mih_packages/mzansi_wallet/components/mih_card_display.dart';
|
import 'package:Mzansi_Innovation_Hub/mih_packages/mzansi_wallet/components/mih_card_display.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:qr_bar_code_scanner_dialog/qr_bar_code_scanner_dialog.dart';
|
||||||
import 'package:simple_barcode_scanner/simple_barcode_scanner.dart';
|
import 'package:simple_barcode_scanner/simple_barcode_scanner.dart';
|
||||||
|
|
||||||
class LoyaltyCards extends StatefulWidget {
|
class LoyaltyCards extends StatefulWidget {
|
||||||
@@ -29,8 +30,10 @@ class _LoyaltyCardsState extends State<LoyaltyCards> {
|
|||||||
late Future<List<MIHLoyaltyCard>> cardList;
|
late Future<List<MIHLoyaltyCard>> cardList;
|
||||||
//bool showSelectedCardType = false;
|
//bool showSelectedCardType = false;
|
||||||
final ValueNotifier<String> shopName = ValueNotifier("");
|
final ValueNotifier<String> shopName = ValueNotifier("");
|
||||||
|
final _qrBarCodeScannerDialogPlugin = QrBarCodeScannerDialog();
|
||||||
|
String? code;
|
||||||
|
|
||||||
void addCardWindow() {
|
void addCardWindow(BuildContext ctxt) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
@@ -101,23 +104,17 @@ class _LoyaltyCardsState extends State<LoyaltyCards> {
|
|||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
MIHButton(
|
MIHButton(
|
||||||
onTap: () async {
|
onTap: () {
|
||||||
String? res = await SimpleBarcodeScanner.scanBarcode(
|
_qrBarCodeScannerDialogPlugin.getPlatformVersion().then((v) {
|
||||||
context,
|
print(v);
|
||||||
barcodeAppBar: const BarcodeAppBar(
|
|
||||||
appBarTitle: 'Scan Barcode',
|
|
||||||
centerTitle: false,
|
|
||||||
enableBackButton: true,
|
|
||||||
backButtonIcon: Icon(Icons.arrow_back),
|
|
||||||
),
|
|
||||||
isShowFlashIcon: true,
|
|
||||||
delayMillis: 500,
|
|
||||||
cameraFace: CameraFace.back,
|
|
||||||
scanFormat: ScanFormat.ALL_FORMATS,
|
|
||||||
);
|
|
||||||
setState(() {
|
|
||||||
cardNumberController.text = res as String;
|
|
||||||
});
|
});
|
||||||
|
_qrBarCodeScannerDialogPlugin.getScannedQrBarCode(
|
||||||
|
context: context,
|
||||||
|
onCode: (code) {
|
||||||
|
setState(() {
|
||||||
|
this.code = code;
|
||||||
|
});
|
||||||
|
});
|
||||||
},
|
},
|
||||||
buttonText: "Scan",
|
buttonText: "Scan",
|
||||||
buttonColor:
|
buttonColor:
|
||||||
@@ -211,7 +208,7 @@ class _LoyaltyCardsState extends State<LoyaltyCards> {
|
|||||||
color:
|
color:
|
||||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
addCardWindow();
|
addCardWindow(context);
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user