GscanKit class
The main barcode scanner widget.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- GscanKit
Constructors
-
GscanKit({Key? key, BoxFit fit = BoxFit.cover, MobileScannerController? controller, bool validator(BarcodeCapture)?, void onDetect(BarcodeCapture)?, void onDetectError(Object, StackTrace)?, Widget errorBuilder(BuildContext, MobileScannerException)?, bool useAppLifecycleState = true, bool setPortraitOrientation = true, bool extendBodyBehindAppBar = true, PreferredSizeWidget? appBar(BuildContext context, MobileScannerController controller)?, Widget? bottomSheetBuilder(BuildContext context, MobileScannerController controller)?, List<
Widget> ? floatingOption, Widget placeholderBuilder(BuildContext)?, Rect? scanWindow, double scanWindowUpdateThreshold = 0.0, GscanOverlayConfig gscanOverlayConfig = const GscanOverlayConfig(), Widget customOverlayBuilder(BuildContext, BoxConstraints, MobileScannerController, bool?)?, void onInitstate()?, void onDispose()?}) -
const
Properties
- appBar → PreferredSizeWidget? Function(BuildContext context, MobileScannerController controller)?
-
A builder for the
AppBarof the scanner screen.final - bottomSheetBuilder → Widget? Function(BuildContext context, MobileScannerController controller)?
-
A builder for a bottom sheet that is displayed below the camera preview.
final
- controller → MobileScannerController?
-
The controller for the mobile scanner.
final
- customOverlayBuilder → Widget Function(BuildContext, BoxConstraints, MobileScannerController, bool?)?
-
A builder for a custom overlay that can be placed on top of the scanner.
This will override the default custom overlay.
final
- errorBuilder → Widget Function(BuildContext, MobileScannerException)?
-
A builder for displaying an error widget when the scanner fails to start.
If null, a default error widget is used.
final
- extendBodyBehindAppBar → bool
-
Whether the body of the scaffold should extend behind the app bar. Defaults to
true.final - fit → BoxFit
-
Defines how the camera preview will be fitted into the layout.
final
-
floatingOption
→ List<
Widget> ? -
floating widget
final
- gscanOverlayConfig → GscanOverlayConfig
-
Configuration for the scanner overlay (lines, borders, colors).
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onDetect → void Function(BarcodeCapture)?
-
The primary callback function that is called when a barcode is detected.
final
- onDetectError → void Function(Object, StackTrace)?
-
A callback function that is called when an error occurs during barcode detection.
final
- onDispose → void Function()?
-
A callback function that is called when the widget is disposed.
final
- onInitstate → void Function()?
-
A callback function that is called when the widget is initialized.
final
- placeholderBuilder → Widget Function(BuildContext)?
-
A builder for a placeholder widget that is displayed while the camera is initializing.
If null, a black
ColoredBoxis used.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scanWindow → Rect?
-
The rectangular area on the screen where the scanner will focus on detecting barcodes.
If null, a default window will be used.
REFACTORED: This is now the single source of truth for the scan window dimensions.
final
- scanWindowUpdateThreshold → double
-
The threshold for updates to the scanWindow.
final
- setPortraitOrientation → bool
-
Locks the screen orientation to portrait mode. Defaults to
true.final - useAppLifecycleState → bool
-
Whether to use the app lifecycle state to pause the camera when the app is paused.
final
- validator → bool Function(BarcodeCapture)?
-
A function that validates a detected barcode.
Returns
trueif the barcode is valid,falseotherwise.final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< GscanKit> -
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