Skip to content

Commit 30f4b6a

Browse files
committed
add more customization to scanner overlay
1 parent 920ebbe commit 30f4b6a

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

lib/src/overlay/scan_window_overlay.dart

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,45 @@ class ScanWindowOverlay extends StatelessWidget {
99
super.key,
1010
required this.controller,
1111
required this.scanWindow,
12+
this.borderColor = Colors.white,
13+
this.borderRadius = BorderRadius.zero,
14+
this.borderStrokeCap = StrokeCap.butt,
15+
this.borderStrokeJoin = StrokeJoin.miter,
16+
this.borderStyle = PaintingStyle.stroke,
17+
this.borderWidth = 2.0,
1218
this.color = const Color(0x80000000),
1319
});
1420

21+
/// The color for the scan window border.
22+
///
23+
/// Defaults to [Colors.white].
24+
final Color borderColor;
25+
26+
/// The border radius for the scan window and its border.
27+
///
28+
/// Defaults to [BorderRadius.zero].
29+
final BorderRadius borderRadius;
30+
31+
/// The stroke cap for the border around the scan window.
32+
///
33+
/// Defaults to [StrokeCap.butt].
34+
final StrokeCap borderStrokeCap;
35+
36+
/// The stroke join for the border around the scan window.
37+
///
38+
/// Defaults to [StrokeJoin.miter].
39+
final StrokeJoin borderStrokeJoin;
40+
41+
/// The style for the border around the scan window.
42+
///
43+
/// Defaults to [PaintingStyle.stroke].
44+
final PaintingStyle borderStyle;
45+
46+
/// The width for the border around the scan window.
47+
///
48+
/// Defaults to 2.0.
49+
final double borderWidth;
50+
1551
/// The color for the scan window box.
1652
///
1753
/// Defaults to [Colors.black] with 50% opacity.
@@ -40,6 +76,12 @@ class ScanWindowOverlay extends StatelessWidget {
4076
return CustomPaint(
4177
size: value.size,
4278
painter: ScanWindowPainter(
79+
borderColor: borderColor,
80+
borderRadius: borderRadius,
81+
borderStrokeCap: borderStrokeCap,
82+
borderStrokeJoin: borderStrokeJoin,
83+
borderStyle: borderStyle,
84+
borderWidth: borderWidth,
4385
scanWindow: scanWindow,
4486
color: color,
4587
),

0 commit comments

Comments
 (0)