AiBarcodeScanner class

Barcode scanner widget

Inheritance

Constructors

AiBarcodeScanner.new({Key? key, required void onScan(String), String? validateText, bool? hasAppBar, Widget? customAppBarWidget, ValidateType? validateType, bool allowDuplicates = false, BoxFit fit = BoxFit.cover, MobileScannerController? controller, void onDetect(BarcodeCapture)?, Color borderColor = Colors.white, double borderWidth = 10, Color overlayColor = const Color.fromRGBO(0, 0, 0, 80), double borderRadius = 10, double borderLength = 40, double cutOutSize = 300, double? cutOutWidth, double? cutOutHeight, double cutOutBottomOffset = 0, String hintText = 'Scan QR Code', EdgeInsetsGeometry hintMargin = const EdgeInsets.symmetric(horizontal: 50, vertical: 10), Color? hintBackgroundColor = Colors.white, TextStyle hintTextStyle = const TextStyle(fontWeight: FontWeight.bold), EdgeInsetsGeometry hintPadding = const EdgeInsets.all(0), bool showOverlay = true, bool showError = true, Color errorColor = Colors.red, String errorText = 'Invalid BarCode', bool showSuccess = true, Color successColor = Colors.green, String successText = 'BarCode Found', bool canPop = true, Widget errorBuilder(BuildContext, MobileScannerException, Widget?)?, Widget placeholderBuilder(BuildContext, Widget?)?, void onScannerStarted(MobileScannerArguments?)?, Rect? scanWindow, bool? startDelay, Widget? hintWidget})

Properties

allowDuplicates bool
Set to false if you don't want duplicate barcode to be detected
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
canPop bool
Can auto back to previous page when barcode is successfully scanned (default: true)
final
controller MobileScannerController?
Barcode controller (optional)
final
customAppBarWidget Widget?
Custom app bar text customAppBarText customAppBarText working with single string value only.
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
errorText String
Error text (default: 'Invalid BarCode')
final
fit BoxFit
Fit to screen
final
hasAppBar bool?
hasAppBar boolean value hasAppBar hasAppBar working with bool value only.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
hintBackgroundColor Color?
Hint background color (optional)
final
hintMargin EdgeInsetsGeometry
Hint margin
final
hintPadding EdgeInsetsGeometry
Hint padding
final
hintText String
Hint text (default: 'Scan QR Code')
final
hintTextStyle TextStyle
Hint text style
final
hintWidget Widget?
Hint widget (optional) (default: Text('Scan QR Code')) Hint widget will be replaced the bottom of the screen. If you want to replace the bottom screen widget, use hintWidget
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onDetect → void Function(BarcodeCapture)?
Function that gets called when a Barcode is detected.
final
onScan → void Function(String)
Function that gets Called when barcode is scanned successfully
final
onScannerStarted → void Function(MobileScannerArguments?)?
The function that signals when the barcode scanner is started.
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?
if set barcodes will only be scanned if they fall within this Rect useful for having a cut-out overlay for example. these Rect coordinates are relative to the widget size, so by how much your rectangle overlays the actual image can depend on things like the BoxFit
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
startDelay bool?
Only set this to true if you are starting another instance of mobile_scanner right after disposing the first one, like in a PageView.
final
successColor Color
Success color (default: green)
final
successText String
Success text (default: 'BarCode Found')
final
validateText String?
Validate barcode text with ValidateType validateText and validateType must be set together.
final
validateType ValidateType?
Validate type ValidateType Validator working with single string value only.
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, int wrapWidth = 65}) 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