ScannerPreview class

Live camera preview with the detection outline, framing guide and grid composited on top.

Drop this anywhere in your own layout:

ScannerPreview(controller: controller)

The outline is interpolated every vsync inside an isolated RepaintBoundary, so a moving document never triggers a rebuild of the camera texture or of your surrounding UI.

Inheritance

Constructors

ScannerPreview({Key? key, required ScannerController controller, bool showOutline = true, bool showGuide = true, bool showGrid = true, bool enableTapToFocus = true, bool enableZoomGesture = true, WidgetBuilder? loadingBuilder, Widget errorBuilder(BuildContext context, String message)?, Widget permissionBuilder(BuildContext context, ScannerController controller)?})
const

Properties

controller → ScannerController
final
enableTapToFocus → bool
final
enableZoomGesture → bool
final
errorBuilder → Widget Function(BuildContext context, String message)?
Shown when the camera is unavailable. Receives the failure message.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
loadingBuilder → WidgetBuilder?
Shown while the camera is starting or suspended.
final
permissionBuilder → Widget Function(BuildContext context, ScannerController controller)?
Shown when the camera permission is missing. Replace it to explain the situation in your own words and styling.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
showGrid → bool
Draw the rule-of-thirds grid when the controller has it enabled.
final
showGuide → bool
Draw the configured paper guide (A4 / Letter).
final
showOutline → bool
Draw the detected document outline and auto-capture ring.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<ScannerPreview>
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