Change qrscan package with updtated API, compatible with iOS
This commit is contained in:
parent
93f041eed8
commit
7a9f2442e2
|
@ -2,6 +2,8 @@
|
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>Camera permission is required for barcode scanning.</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
|
|
|
@ -6,7 +6,8 @@ import 'package:gecko/screens/wallet_view.dart';
|
|||
import 'package:graphql_flutter/graphql_flutter.dart';
|
||||
import 'package:jdenticon_dart/jdenticon_dart.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:qrscan/qrscan.dart' as scanner;
|
||||
// import 'package:qrscan/qrscan.dart' as scanner;
|
||||
import 'package:barcode_scan2/barcode_scan2.dart';
|
||||
import 'dart:math';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
|
@ -31,24 +32,24 @@ class WalletsProfilesProvider with ChangeNotifier {
|
|||
if (Platform.isAndroid || Platform.isIOS) {
|
||||
await Permission.camera.request();
|
||||
}
|
||||
String? barcode;
|
||||
ScanResult? barcode;
|
||||
try {
|
||||
barcode = await scanner.scan();
|
||||
barcode = await BarcodeScanner.scan();
|
||||
} catch (e) {
|
||||
log.e(e);
|
||||
return 'false';
|
||||
}
|
||||
if (barcode != null && isAddress(barcode)) {
|
||||
if (isAddress(barcode.rawContent)) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return WalletViewScreen(pubkey: barcode!);
|
||||
return WalletViewScreen(pubkey: barcode!.rawContent);
|
||||
}),
|
||||
);
|
||||
} else {
|
||||
return 'false';
|
||||
}
|
||||
return barcode;
|
||||
return barcode.rawContent;
|
||||
}
|
||||
|
||||
// Future<String> pay(BuildContext context, {int? derivation}) async {
|
||||
|
|
23
pubspec.lock
23
pubspec.lock
|
@ -57,6 +57,13 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.2.1"
|
||||
barcode_scan2:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: barcode_scan2
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.2.1"
|
||||
bip32_ed25519:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -999,6 +1006,13 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.2.4"
|
||||
protobuf:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: protobuf
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
provider:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -1043,15 +1057,6 @@ packages:
|
|||
url: "https://github.com/insinfo/qr.flutter.git"
|
||||
source: git
|
||||
version: "4.0.0"
|
||||
qrscan:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "."
|
||||
ref: master
|
||||
resolved-ref: "1fb6b45541965190d16ac214fa6d8b632d1f711e"
|
||||
url: "https://github.com/leyan95/qrcode_scanner.git"
|
||||
source: git
|
||||
version: "0.3.3"
|
||||
responsive_builder:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
|
@ -44,11 +44,7 @@ dependencies:
|
|||
pin_code_fields: ^7.3.0
|
||||
printing: ^5.9.1
|
||||
provider: ^6.0.1
|
||||
qrscan: #^0.3.2
|
||||
git:
|
||||
url: https://github.com/leyan95/qrcode_scanner.git
|
||||
ref: master # branch name
|
||||
# qr_code_scanner: ^0.6.1
|
||||
barcode_scan2: ^4.2.1
|
||||
qr_flutter: #^4.0.0
|
||||
git:
|
||||
url: https://github.com/insinfo/qr.flutter.git
|
||||
|
|
Loading…
Reference in New Issue