Overlay example does not apply background opacity correctly
I'm using the overlay example as a guide for building a feature in my app, and I noticed that the background opacity is not being applied outside of the scan window correctly:
I'm a beginner flutter dev, so I don't know what might be causing this.
This could be a bug in the example. Although, I think that the example just draws the white rectangle, and nothing else.
From what I can tell, it does try to apply some opacity.
https://github.com/juliansteenbakker/mobile_scanner/blob/c3271f0cda3df5594a4cebc02696007657785861/example/lib/mobile_scanner_overlay.dart#L147C21-L147C41
// First, draw the background,
// with a cutout area that is a bit larger than the scan window.
// Finally, draw the scan window itself.
canvas.drawPath(backgroundWithCutout, backgroundPaint);
canvas.drawRRect(borderRect, borderPaint);
In ScannerOverlay example class, changing from:
final backgroundPaint = Paint()
..color = Colors.black.withOpacity(0.5)
..style = PaintingStyle.fill
..blendMode = BlendMode.dstOut;
to
final backgroundPaint = Paint()
..color = Colors.black.withOpacity(0.5)
..style = PaintingStyle.fill
..blendMode = BlendMode.srcOver; // <- This line
will add the background opacity.
@RobertCer I'm not having any luck with that, did you change anything else as well?
Edit: Ah hah, changing from Rect.largest to Rect.fromLTWH(0, 0, size.width, size.height) seems to solve it for me. I'll make a quick PR.