juliuscanute / qr_code_scanner

QR Code Scanner for Flutter
BSD 2-Clause "Simplified" License
1.01k stars 782 forks source link

[BUG] I enter the code scanning page for the first time, the code scanning area is incorrect. #253

Closed 0FengQiang0 closed 3 years ago

0FengQiang0 commented 3 years ago

When I enter the code scanning page for the first time, the code scanning area is incorrect. After returning to the previous page, I re-enter the code scanning area and the code scanning area is correct,My QRView is full screen.

my device is iPhone12,and iphoneSE2, OS version:iOS 14.4, qr_code_scanner version:0.3.2

here is my code: Barcode result; QRViewController controller; final GlobalKey qrKey = GlobalKey(debugLabel: 'QR');

void reassemble() { super.reassemble(); if (Platform.isAndroid) { controller.pauseCamera(); } else if (Platform.isIOS) { controller.resumeCamera(); } }

@override Widget build(BuildContext context) { return Scaffold( body: _buildQrView(context), ); }

Widget _buildQrView(BuildContext context) { return QRView( key: qrKey, formatsAllowed: [BarcodeFormat.qrcode,BarcodeFormat.code128,BarcodeFormat.code39,BarcodeFormat.code93,BarcodeFormat.ean8,BarcodeFormat.upcE,BarcodeFormat.pdf417,BarcodeFormat.ean13,], onQRViewCreated: _onQRViewCreated, ); }

void _onQRViewCreated(QRViewController controller) { setState(() { this.controller = controller; }); controller.scannedDataStream.listen((scanData) { setState(() { result = scanData; print("result:$result"); }); }); }

@override void dispose() { controller?.dispose(); super.dispose(); }

juliansteenbakker commented 3 years ago

This is a duplicate of #250. A fix is almost ready.