AiBarcodeScanner class

Barcode scanner widget

Inheritance

Constructors

AiBarcodeScanner({Key? key, BoxFit fit = BoxFit.cover, MobileScannerController? controller, Color? borderColor, double? cutOutWidth, double? cutOutHeight, double borderWidth = 12, Color overlayColor = const Color.fromRGBO(0, 0, 0, 82), double borderRadius = 24, double borderLength = 42, double cutOutSize = 352, double cutOutBottomOffset = 124, double scanWindowUpdateThreshold = 0.0, bool showOverlay = true, bool showError = true, bool showSuccess = true, Color errorColor = Colors.red, Color successColor = Colors.green, Widget errorBuilder(BuildContext, MobileScannerException, Widget?)?, Widget placeholderBuilder(BuildContext, Widget?)?, void onDispose()?, Rect? scanWindow, PreferredSizeWidget? appBar, LayoutWidgetBuilder? overlayBuilder, void onDetect(BarcodeCapture)?, bool validator(BarcodeCapture)?, void onImagePick(String?)?, String title = 'Scan any QR code', Widget child = const SizedBox.shrink(), bool hideDragHandler = false, bool hideTitle = false, AlignmentGeometry? buttonAlignment, List<Widget>? actions, void onPop()?})
const

Properties

actions List<Widget>?
actions for the app bar (optional) Camera switch and torch toggle buttons are added by default You can add more actions to the app bar using this parameter
final
appBar PreferredSizeWidget?
AppBar widget you can use this to add appBar to the scanner screen
final
borderColor Color?
Overlay border color (default: white)
final
borderLength double
Overlay border length (default: 30)
final
borderRadius double
Overlay border radius (default: 10)
final
borderWidth double
Overlay border width (default: 10)
final
buttonAlignment AlignmentGeometry?
Upload from gallery button alignment default: bottom center, center, 0.75
final
child Widget
Child widget for the draggable sheet (default: SizedBox.shrink())
final
controller MobileScannerController?
Barcode controller (optional)
final
cutOutBottomOffset double
Overlay cut out offset (default: 0)
final
cutOutHeight double?
Overlay cut out height (optional)
final
cutOutSize double
Overlay cut out size (default: 300)
final
cutOutWidth double?
Overlay cut out width (optional)
final
errorBuilder → (Widget Function(BuildContext, MobileScannerException, Widget?)?)
The function that builds an error widget when the scanner could not be started.
final
errorColor Color
Error color (default: red)
final
fit BoxFit
Fit to screen
final
hashCode int
The hash code for this object.
no setterinherited
hideDragHandler bool
Hide drag handler of the draggable sheet (default: false)
final
hideTitle bool
Hide title of the draggable sheet (default: false)
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onDetect → (void Function(BarcodeCapture)?)
The threshold for updates to the scanWindow.
final
onDispose → (void Function()?)
Called when this object is removed from the tree permanently.
final
onImagePick → (void Function(String?)?)
final
onPop → (void Function()?)
Optional function to be called when clicking the back button on the app bar If not provided, the default behavior is to pop the current route from the navigator
final
overlayBuilder LayoutWidgetBuilder?
The builder for the overlay above the camera preview.
final
overlayColor Color
Overlay color
final
placeholderBuilder → (Widget Function(BuildContext, Widget?)?)
The function that builds a placeholder widget when the scanner is not yet displaying its camera preview.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scanWindow Rect?
The scan window rectangle for the barcode scanner.
final
scanWindowUpdateThreshold double
The threshold for updates to the scanWindow.
final
showError bool
Show error or not (default: true)
final
showOverlay bool
Show overlay or not (default: true)
final
showSuccess bool
Show success or not (default: true)
final
successColor Color
Success color (default: green)
final
title String
Title for the draggable sheet (default: 'Scan any QR code')
final
validator → (bool Function(BarcodeCapture)?)
Validator function to check if barcode is valid or not
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<AiBarcodeScanner>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited