diff --git a/example/lib/main.dart b/example/lib/main.dart index 25855f9..cb5701c 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -40,6 +40,7 @@ class _QRViewExampleState extends State { borderLength: 30, borderWidth: 10, cutOutSize: 300, + cutOutBottomOffset: 24, ), ), ), diff --git a/lib/src/qr_code_scanner.dart b/lib/src/qr_code_scanner.dart index 8bedf5e..fad8126 100644 --- a/lib/src/qr_code_scanner.dart +++ b/lib/src/qr_code_scanner.dart @@ -11,7 +11,6 @@ class QRView extends StatefulWidget { @required Key key, @required this.onQRViewCreated, this.overlay, - this.overlayMargin = EdgeInsets.zero, }) : assert(key != null), assert(onQRViewCreated != null), super(key: key); @@ -19,7 +18,6 @@ class QRView extends StatefulWidget { final QRViewCreatedCallback onQRViewCreated; final ShapeBorder overlay; - final EdgeInsetsGeometry overlayMargin; @override State createState() => _QRViewState(); @@ -33,7 +31,6 @@ class _QRViewState extends State { _getPlatformQrView(), if (widget.overlay != null) Container( - padding: widget.overlayMargin, decoration: ShapeDecoration( shape: widget.overlay, ), diff --git a/lib/src/qr_scanner_overlay_shape.dart b/lib/src/qr_scanner_overlay_shape.dart index 886c533..77c1a14 100644 --- a/lib/src/qr_scanner_overlay_shape.dart +++ b/lib/src/qr_scanner_overlay_shape.dart @@ -10,6 +10,7 @@ class QrScannerOverlayShape extends ShapeBorder { this.borderRadius = 0, this.borderLength = 40, this.cutOutSize = 250, + this.cutOutBottomOffset = 0, }) : assert( cutOutSize != null ?? cutOutSize != null ?? @@ -22,6 +23,7 @@ class QrScannerOverlayShape extends ShapeBorder { final double borderRadius; final double borderLength; final double cutOutSize; + final double cutOutBottomOffset; @override EdgeInsetsGeometry get dimensions => const EdgeInsets.all(10); @@ -86,7 +88,11 @@ class QrScannerOverlayShape extends ShapeBorder { final cutOutRect = Rect.fromLTWH( rect.left + width / 2 - _cutOutSize / 2 + borderOffset, - rect.top + height / 2 - _cutOutSize / 2 + borderOffset, + -cutOutBottomOffset + + rect.top + + height / 2 - + _cutOutSize / 2 + + borderOffset, _cutOutSize - borderOffset * 2, _cutOutSize - borderOffset * 2, );