forked from yaso_meth/mih-project
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/components/mih_card_display.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';
|
||||
|
||||
class LoyaltyCards extends StatefulWidget {
|
||||
@@ -29,8 +30,10 @@ class _LoyaltyCardsState extends State<LoyaltyCards> {
|
||||
late Future<List<MIHLoyaltyCard>> cardList;
|
||||
//bool showSelectedCardType = false;
|
||||
final ValueNotifier<String> shopName = ValueNotifier("");
|
||||
final _qrBarCodeScannerDialogPlugin = QrBarCodeScannerDialog();
|
||||
String? code;
|
||||
|
||||
void addCardWindow() {
|
||||
void addCardWindow(BuildContext ctxt) {
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
@@ -101,23 +104,17 @@ class _LoyaltyCardsState extends State<LoyaltyCards> {
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
MIHButton(
|
||||
onTap: () async {
|
||||
String? res = await SimpleBarcodeScanner.scanBarcode(
|
||||
context,
|
||||
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;
|
||||
onTap: () {
|
||||
_qrBarCodeScannerDialogPlugin.getPlatformVersion().then((v) {
|
||||
print(v);
|
||||
});
|
||||
_qrBarCodeScannerDialogPlugin.getScannedQrBarCode(
|
||||
context: context,
|
||||
onCode: (code) {
|
||||
setState(() {
|
||||
this.code = code;
|
||||
});
|
||||
});
|
||||
},
|
||||
buttonText: "Scan",
|
||||
buttonColor:
|
||||
@@ -211,7 +208,7 @@ class _LoyaltyCardsState extends State<LoyaltyCards> {
|
||||
color:
|
||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||
onPressed: () {
|
||||
addCardWindow();
|
||||
addCardWindow(context);
|
||||
},
|
||||
)
|
||||
],
|
||||
|
||||
@@ -628,10 +628,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: js
|
||||
sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf
|
||||
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.1"
|
||||
version: "0.6.7"
|
||||
json_annotation:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -960,6 +960,22 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
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:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -63,7 +63,8 @@ dependencies:
|
||||
youtube_player_iframe: ^5.2.0
|
||||
syncfusion_flutter_barcodes: ^26.2.10
|
||||
simple_barcode_scanner: ^0.2.5
|
||||
|
||||
qr_bar_code_scanner_dialog: ^0.0.5
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
Reference in New Issue
Block a user