Skip to content

Commit 29dbcc3

Browse files
committed
Fix scanner overlay examples
1 parent c3271f0 commit 29dbcc3

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

example/lib/barcode_scanner_window.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,15 @@ class ScannerOverlay extends CustomPainter {
131131

132132
@override
133133
void paint(Canvas canvas, Size size) {
134-
// TODO: use `Offset.zero & size` instead of Rect.largest
135134
// we need to pass the size to the custom paint widget
136-
final backgroundPath = Path()..addRect(Rect.largest);
135+
final backgroundPath = Path()
136+
..addRect(Rect.fromLTWH(0, 0, size.width, size.height));
137137
final cutoutPath = Path()..addRect(scanWindow);
138138

139139
final backgroundPaint = Paint()
140140
..color = Colors.black.withOpacity(0.5)
141141
..style = PaintingStyle.fill
142-
..blendMode = BlendMode.dstOut;
142+
..blendMode = BlendMode.dstOver;
143143

144144
final backgroundWithCutout = Path.combine(
145145
PathOperation.difference,

example/lib/mobile_scanner_overlay.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ class ScannerOverlay extends CustomPainter {
102102

103103
@override
104104
void paint(Canvas canvas, Size size) {
105-
// TODO: use `Offset.zero & size` instead of Rect.largest
106105
// we need to pass the size to the custom paint widget
107-
final backgroundPath = Path()..addRect(Rect.largest);
106+
final backgroundPath = Path()
107+
..addRect(Rect.fromLTWH(0, 0, size.width, size.height));
108108

109109
final cutoutPath = Path()
110110
..addRRect(
@@ -120,7 +120,7 @@ class ScannerOverlay extends CustomPainter {
120120
final backgroundPaint = Paint()
121121
..color = Colors.black.withOpacity(0.5)
122122
..style = PaintingStyle.fill
123-
..blendMode = BlendMode.dstOut;
123+
..blendMode = BlendMode.dstOver;
124124

125125
final backgroundWithCutout = Path.combine(
126126
PathOperation.difference,

0 commit comments

Comments
 (0)