@@ -9,42 +9,126 @@ import 'overlay.dart';
99
1010/// Barcode scanner widget
1111class AiBarcodeScanner extends StatefulWidget {
12+ /// Fit to screen
1213 final BoxFit fit;
14+
15+ /// Barcode controller (optional)
1316 final MobileScannerController ? controller;
17+
18+ /// You can use your own custom overlay builder
19+ /// to build your own overlay
20+ /// This will override the default custom overlay
1421 final Widget ? Function (BuildContext , bool ? , MobileScannerController )? customOverlayBuilder;
22+
23+ /// Overlay border color (default: white)
1524 final Color ? borderColor;
25+
26+ /// Overlay border width (default: 10)
1627 final double borderWidth;
28+
29+ /// Overlay color
1730 final Color overlayColor;
31+
32+ /// Overlay border radius (default: 10)
1833 final double borderRadius;
34+
35+ /// Overlay border length (default: 30)
1936 final double borderLength;
37+
38+ /// Overlay cut out width (optional)
2039 final double ? cutOutWidth;
40+
41+ /// Overlay cut out height (optional)
2142 final double ? cutOutHeight;
43+
44+ /// Overlay cut out offset (default: 0)
2245 final double cutOutBottomOffset;
46+
47+ /// Overlay cut out size (default: 300)
2348 final double cutOutSize;
49+
50+ /// Show error or not (default: true)
2451 final bool showError;
52+
53+ /// Error color (default: red)
2554 final Color errorColor;
55+
56+ /// Show success or not (default: true)
2657 final bool showSuccess;
58+
59+ /// Success color (default: green)
2760 final Color successColor;
61+
62+ /// The function that builds an error widget when the scanner
63+ /// could not be started.
64+ ///
65+ /// If this is null, defaults to a black [ColoredBox]
66+ /// with a centered white [Icons.error] icon.
2867 final Widget Function (BuildContext , MobileScannerException , Widget ? )? errorBuilder;
68+
69+ /// The function that builds a placeholder widget when the scanner
70+ /// is not yet displaying its camera preview.
71+ ///
72+ /// If this is null, a black [ColoredBox] is used as placeholder.
2973 final Widget Function (BuildContext , Widget ? )? placeholderBuilder;
74+
75+ /// Called when this object is removed from the tree permanently.
3076 final void Function ()? onDispose;
77+
78+ /// AppBar widget
79+ /// you can use this to add appBar to the scanner screen
3180 final PreferredSizeWidget ? Function (BuildContext context, MobileScannerController controller)? appBarBuilder;
81+
82+ /// The builder for the bottom sheet.
83+ /// This is displayed below the camera preview.
3284 final Widget ? Function (BuildContext context, MobileScannerController controller)? bottomSheetBuilder;
85+
86+ /// The builder for the overlay above the camera preview.
3387 final LayoutWidgetBuilder ? overlayBuilder;
88+
89+ /// The scan window rectangle for the barcode scanner.
3490 final Rect ? scanWindow;
35- final void Function (BarcodeCapture )? onDetect;
91+
92+ /// The threshold for updates to the [scanWindow] .
93+ final double scanWindowUpdateThreshold;
94+
95+ /// Validator function to check if barcode is valid or not
3696 final bool Function (BarcodeCapture )? validator;
97+
3798 final void Function (String ? )? onImagePick;
38- final double scanWindowUpdateThreshold;
99+
100+ /// Title for the draggable sheet (default: 'Scan any QR code')
39101 final String sheetTitle;
102+
103+ /// Child widget for the draggable sheet (default: SizedBox.shrink())
40104 final Widget sheetChild;
105+
106+ /// Hide drag handler of the draggable sheet (default: false)
41107 final bool hideSheetDragHandler;
108+
109+ /// Hide title of the draggable sheet (default: false)
42110 final bool hideSheetTitle;
111+
112+ /// Hide gallery button (default: false)
113+ /// This will hide the gallery button at the bottom of the screen
43114 final bool hideGalleryButton;
115+
116+ /// Hide gallery icon (default: false)
117+ /// This will hide the gallery icon in the app bar
44118 final bool hideGalleryIcon;
119+
120+ /// Extend body behind app bar (default: true)
45121 final bool extendBodyBehindAppBar;
122+
123+ /// Upload from gallery button alignment
46124 final AlignmentGeometry ? galleryButtonAlignment;
125+
126+ /// actions for the app bar (optional)
127+ /// Camera switch and torch toggle buttons are added by default
128+ /// You can add more actions to the app bar using this parameter
47129 final List <Widget >? actions;
130+
131+ /// Lock orientation to portrait (default: true)
48132 final bool setPortraitOrientation;
49133
50134 const AiBarcodeScanner ({
0 commit comments