diff --git a/example/lib/main.dart b/example/lib/main.dart index 2cdab32..5134972 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -148,12 +148,16 @@ class _QRViewExampleState extends State { Widget _buildQrView(BuildContext context) { // For this example we check how width or tall the device is and change the scanArea and overlay accordingly. - double scanArea = (MediaQuery.of(context).size.width < 500 || MediaQuery.of(context).size.height < 400) ? 150 : 300; + double scanArea = (MediaQuery.of(context).size.width < 500 || + MediaQuery.of(context).size.height < 400) + ? 150 + : 300; // To ensure the Scanner view is properly sizes after rotation // we need to listen for Flutter SizeChanged notification and update controller return NotificationListener( onNotification: (notification) { - Future.microtask(() => controller?.updateDimensions(qrKey, scanArea: scanArea)); + Future.microtask( + () => controller?.updateDimensions(qrKey, scanArea: scanArea)); return false; }, child: SizeChangedLayoutNotifier( diff --git a/lib/src/qr_code_scanner.dart b/lib/src/qr_code_scanner.dart index 5b583c1..aa7d20a 100644 --- a/lib/src/qr_code_scanner.dart +++ b/lib/src/qr_code_scanner.dart @@ -138,7 +138,9 @@ class _QRViewState extends State { _platformQrView = UiKitView( viewType: 'net.touchcapture.qr.flutterqr/qrview', onPlatformViewCreated: _onPlatformViewCreated, - creationParams: _CreationParams.fromWidget(MediaQuery.of(context).size.width, 400).toMap(), + creationParams: + _CreationParams.fromWidget(MediaQuery.of(context).size.width, 400) + .toMap(), creationParamsCodec: StandardMessageCodec(), ); break; @@ -154,7 +156,8 @@ class _QRViewState extends State { return; } - widget.onQRViewCreated(QRViewController._(id, widget.key, (widget.overlay as QrScannerOverlayShape).cutOutSize)); + widget.onQRViewCreated(QRViewController._( + id, widget.key, (widget.overlay as QrScannerOverlayShape).cutOutSize)); } } @@ -236,10 +239,11 @@ class QRViewController { void updateDimensions(GlobalKey key, {double scanArea}) { if (defaultTargetPlatform == TargetPlatform.iOS) { final RenderBox renderBox = key.currentContext.findRenderObject(); - _channel.invokeMethod('setDimensions', - {'width': renderBox.size.width, - 'height': renderBox.size.height, - 'scanArea': scanArea?? 0}); + _channel.invokeMethod('setDimensions', { + 'width': renderBox.size.width, + 'height': renderBox.size.height, + 'scanArea': scanArea ?? 0 + }); } } }