Просмотр исходного кода

Restore XCode files

flutter-beta
Pedro Belfort 6 лет назад
Родитель
Сommit
2dc74e0fb8
3 измененных файлов: 8 добавлений и 4 удалений
  1. +1
    -0
      example/lib/main.dart
  2. +0
    -3
      lib/src/qr_code_scanner.dart
  3. +7
    -1
      lib/src/qr_scanner_overlay_shape.dart

+ 1
- 0
example/lib/main.dart Просмотреть файл

@@ -40,6 +40,7 @@ class _QRViewExampleState extends State<QRViewExample> {
borderLength: 30, borderLength: 30,
borderWidth: 10, borderWidth: 10,
cutOutSize: 300, cutOutSize: 300,
cutOutBottomOffset: 24,
), ),
), ),
), ),


+ 0
- 3
lib/src/qr_code_scanner.dart Просмотреть файл

@@ -11,7 +11,6 @@ class QRView extends StatefulWidget {
@required Key key, @required Key key,
@required this.onQRViewCreated, @required this.onQRViewCreated,
this.overlay, this.overlay,
this.overlayMargin = EdgeInsets.zero,
}) : assert(key != null), }) : assert(key != null),
assert(onQRViewCreated != null), assert(onQRViewCreated != null),
super(key: key); super(key: key);
@@ -19,7 +18,6 @@ class QRView extends StatefulWidget {
final QRViewCreatedCallback onQRViewCreated; final QRViewCreatedCallback onQRViewCreated;


final ShapeBorder overlay; final ShapeBorder overlay;
final EdgeInsetsGeometry overlayMargin;


@override @override
State<StatefulWidget> createState() => _QRViewState(); State<StatefulWidget> createState() => _QRViewState();
@@ -33,7 +31,6 @@ class _QRViewState extends State<QRView> {
_getPlatformQrView(), _getPlatformQrView(),
if (widget.overlay != null) if (widget.overlay != null)
Container( Container(
padding: widget.overlayMargin,
decoration: ShapeDecoration( decoration: ShapeDecoration(
shape: widget.overlay, shape: widget.overlay,
), ),


+ 7
- 1
lib/src/qr_scanner_overlay_shape.dart Просмотреть файл

@@ -10,6 +10,7 @@ class QrScannerOverlayShape extends ShapeBorder {
this.borderRadius = 0, this.borderRadius = 0,
this.borderLength = 40, this.borderLength = 40,
this.cutOutSize = 250, this.cutOutSize = 250,
this.cutOutBottomOffset = 0,
}) : assert( }) : assert(
cutOutSize != null ?? cutOutSize != null ??
cutOutSize != null ?? cutOutSize != null ??
@@ -22,6 +23,7 @@ class QrScannerOverlayShape extends ShapeBorder {
final double borderRadius; final double borderRadius;
final double borderLength; final double borderLength;
final double cutOutSize; final double cutOutSize;
final double cutOutBottomOffset;


@override @override
EdgeInsetsGeometry get dimensions => const EdgeInsets.all(10); EdgeInsetsGeometry get dimensions => const EdgeInsets.all(10);
@@ -86,7 +88,11 @@ class QrScannerOverlayShape extends ShapeBorder {


final cutOutRect = Rect.fromLTWH( final cutOutRect = Rect.fromLTWH(
rect.left + width / 2 - _cutOutSize / 2 + borderOffset, 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,
_cutOutSize - borderOffset * 2, _cutOutSize - borderOffset * 2,
); );


Загрузка…
Отмена
Сохранить