Committed by
GitHub
Merge pull request #1230 from IanVS/overlay-example
fix: scanner overlay example
Showing
2 changed files
with
6 additions
and
6 deletions
| @@ -131,15 +131,15 @@ class ScannerOverlay extends CustomPainter { | @@ -131,15 +131,15 @@ class ScannerOverlay extends CustomPainter { | ||
| 131 | 131 | ||
| 132 | @override | 132 | @override |
| 133 | void paint(Canvas canvas, Size size) { | 133 | void paint(Canvas canvas, Size size) { |
| 134 | - // TODO: use `Offset.zero & size` instead of Rect.largest | ||
| 135 | // we need to pass the size to the custom paint widget | 134 | // 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)); | ||
| 137 | final cutoutPath = Path()..addRect(scanWindow); | 137 | final cutoutPath = Path()..addRect(scanWindow); |
| 138 | 138 | ||
| 139 | final backgroundPaint = Paint() | 139 | final backgroundPaint = Paint() |
| 140 | ..color = Colors.black.withOpacity(0.5) | 140 | ..color = Colors.black.withOpacity(0.5) |
| 141 | ..style = PaintingStyle.fill | 141 | ..style = PaintingStyle.fill |
| 142 | - ..blendMode = BlendMode.dstOut; | 142 | + ..blendMode = BlendMode.dstOver; |
| 143 | 143 | ||
| 144 | final backgroundWithCutout = Path.combine( | 144 | final backgroundWithCutout = Path.combine( |
| 145 | PathOperation.difference, | 145 | PathOperation.difference, |
| @@ -102,9 +102,9 @@ class ScannerOverlay extends CustomPainter { | @@ -102,9 +102,9 @@ class ScannerOverlay extends CustomPainter { | ||
| 102 | 102 | ||
| 103 | @override | 103 | @override |
| 104 | void paint(Canvas canvas, Size size) { | 104 | void paint(Canvas canvas, Size size) { |
| 105 | - // TODO: use `Offset.zero & size` instead of Rect.largest | ||
| 106 | // we need to pass the size to the custom paint widget | 105 | // 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)); | ||
| 108 | 108 | ||
| 109 | final cutoutPath = Path() | 109 | final cutoutPath = Path() |
| 110 | ..addRRect( | 110 | ..addRRect( |
| @@ -120,7 +120,7 @@ class ScannerOverlay extends CustomPainter { | @@ -120,7 +120,7 @@ class ScannerOverlay extends CustomPainter { | ||
| 120 | final backgroundPaint = Paint() | 120 | final backgroundPaint = Paint() |
| 121 | ..color = Colors.black.withOpacity(0.5) | 121 | ..color = Colors.black.withOpacity(0.5) |
| 122 | ..style = PaintingStyle.fill | 122 | ..style = PaintingStyle.fill |
| 123 | - ..blendMode = BlendMode.dstOut; | 123 | + ..blendMode = BlendMode.dstOver; |
| 124 | 124 | ||
| 125 | final backgroundWithCutout = Path.combine( | 125 | final backgroundWithCutout = Path.combine( |
| 126 | PathOperation.difference, | 126 | PathOperation.difference, |
-
Please register or login to post a comment