Merge pull request #8 from yaso-meth/mzansi-wallet-scanner-fix
Mzansi-wallet-scanner-fix
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);
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -628,10 +628,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: js
|
name: js
|
||||||
sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf
|
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.7.1"
|
version: "0.6.7"
|
||||||
json_annotation:
|
json_annotation:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -960,6 +960,22 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.2"
|
version: "3.0.2"
|
||||||
|
qr_bar_code_scanner_dialog:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: qr_bar_code_scanner_dialog
|
||||||
|
sha256: dcb937816d4e562141530265bd1ca39fe00f57000fd79e26c163c957d443e9e4
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.0.5"
|
||||||
|
qr_code_scanner:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: qr_code_scanner
|
||||||
|
sha256: f23b68d893505a424f0bd2e324ebea71ed88465d572d26bb8d2e78a4749591fd
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.1"
|
||||||
realtime_client:
|
realtime_client:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -63,7 +63,8 @@ dependencies:
|
|||||||
youtube_player_iframe: ^5.2.0
|
youtube_player_iframe: ^5.2.0
|
||||||
syncfusion_flutter_barcodes: ^26.2.10
|
syncfusion_flutter_barcodes: ^26.2.10
|
||||||
simple_barcode_scanner: ^0.2.5
|
simple_barcode_scanner: ^0.2.5
|
||||||
|
qr_bar_code_scanner_dialog: ^0.0.5
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|||||||
Reference in New Issue
Block a user