Selaa lähdekoodia

Added possibility to choose facing camera on start.

Moved the size listener to plugin side.
flutter-beta
Julian Steenbakker 5 vuotta sitten
vanhempi
commit
f3b3452570
No known key found for this signature in database GPG Key ID: 16E437C7A3D94250
1 muutettua tiedostoa jossa 8 lisäystä ja 13 poistoa
  1. +8
    -13
      lib/src/qr_code_scanner.dart

+ 8
- 13
lib/src/qr_code_scanner.dart Näytä tiedosto

@@ -132,8 +132,8 @@ class _QRViewState extends State<QRView> {
_channel = MethodChannel('net.touchcapture.qr.flutterqr/qrview_$id');

// Start scan after creation of the view
final controller = QRViewController._(_channel, widget.key, cutOutSize,
widget.onPermissionSet)
final controller = QRViewController._(
_channel, widget.key, cutOutSize, widget.onPermissionSet)
.._startScan(widget.key, cutOutSize, widget.formatsAllowed);

// Initialize the controller for controlling the QRView
@@ -158,12 +158,9 @@ class _QrCameraSettings {
}

class QRViewController {
QRViewController._(
MethodChannel channel,
GlobalKey qrKey,
double scanArea,
PermissionSetCallback onPermissionSet
) : _channel = channel {
QRViewController._(MethodChannel channel, GlobalKey qrKey, double scanArea,
PermissionSetCallback onPermissionSet)
: _channel = channel {
_channel.setMethodCallHandler((call) async {
switch (call.method) {
case 'onRecognizeQR':
@@ -212,14 +209,12 @@ class QRViewController {
bool get hasPermissions => _hasPermissions;

/// Starts the barcode scanner
Future<void> _startScan(
GlobalKey key,
double cutOutSize,
Future<void> _startScan(GlobalKey key, double cutOutSize,
List<BarcodeFormat> barcodeFormats) async {
// We need to update the dimension before the scan is started.
QRViewController.updateDimensions(key, _channel, scanArea: cutOutSize);
return _channel.invokeMethod('startScan',
barcodeFormats?.map((e) => e.asInt())?.toList() ?? []);
return _channel.invokeMethod(
'startScan', barcodeFormats?.map((e) => e.asInt())?.toList() ?? []);
}

/// Gets information about which camera is active.


Ladataan…
Peruuta
Tallenna