UScannerPage class

A ready-to-use full-screen scanner page wrapping UScanner in a UScaffold.

By default it pops with the scanned string (UNavigator.back<String>(value)) so it can be awaited with UScannerPage.open. Every UScanner option is forwarded, plus page-level app bar / background customization.

Inheritance
Available extensions

Constructors

UScannerPage({String? title, PreferredSizeWidget? appBar, bool showAppBar = true, Color? backgroundColor, bool autoPopOnScan = true, ValueChanged<String>? onScan, ValueChanged<BarcodeCapture>? onCapture, ValueChanged<List<Barcode>>? onBarcodes, void onScanError(Object error, StackTrace stackTrace)?, MobileScannerController? controller, bool autoStart = true, Size? cameraResolution, CameraLensType lensType = CameraLensType.any, DetectionSpeed detectionSpeed = DetectionSpeed.normal, int detectionTimeoutMs = 250, CameraFacing facing = CameraFacing.back, List<BarcodeFormat> formats = const <BarcodeFormat>[], bool returnImage = false, bool torchEnabled = false, bool invertImage = false, bool autoZoom = false, double? initialZoom, BoxFit fit = BoxFit.cover, Widget errorBuilder(BuildContext, MobileScannerException)?, WidgetBuilder? placeholderBuilder, LayoutWidgetBuilder? overlayBuilder, Rect? scanWindow, bool restrictToScanWindow = false, double scanWindowUpdateThreshold = 0.0, bool useAppLifecycleState = true, bool tapToFocus = false, bool singleScan = true, bool hapticOnScan = true, bool showOverlay = true, Color? overlayColor, Size scanWindowSize = const Size(280, 280), Color? borderColor, double borderWidth = 3, double borderRadius = 16, double cornerLength = 32, bool showCorners = true, bool showFullBorder = false, bool showScanLine = true, Color? scanLineColor, double scanLineThickness = 2, Duration scanLineDuration = const Duration(seconds: 2), String? hintText, bool showHint = true, TextStyle? hintTextStyle, UScannerHintPosition hintPosition = UScannerHintPosition.bottom, double hintGap = 20, EdgeInsets hintPadding = const EdgeInsets.symmetric(horizontal: 14, vertical: 10), Color? hintBackgroundColor, double hintBorderRadius = 12, bool showControls = true, bool showTorchButton = true, bool showSwitchCameraButton = true, bool showGalleryButton = false, Alignment controlsAlignment = Alignment.bottomCenter, double controlsSpacing = 24, EdgeInsets controlsPadding = const EdgeInsets.only(bottom: 40), Color? controlIconColor, Color? controlActiveIconColor, Color? controlBackgroundColor, double controlButtonSize = 52, double controlIconSize = 26, IconData torchOnIcon = Icons.flash_on_rounded, IconData torchOffIcon = Icons.flash_off_rounded, IconData switchCameraIcon = Icons.cameraswitch_rounded, IconData galleryIcon = Icons.photo_library_rounded, Key? key})
const

Properties

appBar → PreferredSizeWidget?
final
autoPopOnScan → bool
final
autoStart → bool
final
autoZoom → bool
final
backgroundColor → Color?
final
borderColor → Color?
final
borderRadius → double
final
borderWidth → double
final
cameraResolution → Size?
final
controlActiveIconColor → Color?
final
controlBackgroundColor → Color?
final
controlButtonSize → double
final
controlIconColor → Color?
final
controlIconSize → double
final
controller → MobileScannerController?
final
controlsAlignment → Alignment
final
controlsPadding → EdgeInsets
final
controlsSpacing → double
final
cornerLength → double
final
detectionSpeed → DetectionSpeed
final
detectionTimeoutMs → int
final
errorBuilder → Widget Function(BuildContext, MobileScannerException)?
final
facing → CameraFacing
final
fit → BoxFit
final
formats → List<BarcodeFormat>
final
galleryIcon → IconData
final
hapticOnScan → bool
final
hashCode → int
The hash code for this object.
no setterinherited
hintBackgroundColor → Color?
final
hintBorderRadius → double
final
hintGap → double
final
hintPadding → EdgeInsets
final
hintPosition → UScannerHintPosition
final
hintText → String?
final
hintTextStyle → TextStyle?
final
initialZoom → double?
final
invertImage → bool
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
lensType → CameraLensType
final
onBarcodes → ValueChanged<List<Barcode>>?
final
onCapture → ValueChanged<BarcodeCapture>?
final
onScan → ValueChanged<String>?
final
onScanError → void Function(Object error, StackTrace stackTrace)?
final
overlayBuilder → LayoutWidgetBuilder?
final
overlayColor → Color?
final
placeholderBuilder → WidgetBuilder?
final
restrictToScanWindow → bool
final
returnImage → bool
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scanLineColor → Color?
final
scanLineDuration → Duration
final
scanLineThickness → double
final
scanWindow → Rect?
final
scanWindowSize → Size
final
scanWindowUpdateThreshold → double
final
showAppBar → bool
final
showControls → bool
final
showCorners → bool
final
showFullBorder → bool
final
showGalleryButton → bool
final
showHint → bool
final
showOverlay → bool
final
showScanLine → bool
final
showSwitchCameraButton → bool
final
showTorchButton → bool
final
singleScan → bool
final
switchCameraIcon → IconData
final
tapToFocus → bool
final
title → String?
final
torchEnabled → bool
final
torchOffIcon → IconData
final
torchOnIcon → IconData
final
useAppLifecycleState → bool
final

Methods

alignAtBottomCenter({Key? key, double? heightFactor, double? widthFactor}) → Align

Available on Widget, provided by the WidgetsExtension extension

alignAtBottomLeft({Key? key, double? heightFactor, double? widthFactor}) → Align

Available on Widget, provided by the WidgetsExtension extension

alignAtBottomRight({Key? key, double? heightFactor, double? widthFactor}) → Align

Available on Widget, provided by the WidgetsExtension extension

alignAtCenter({Key? key, double? heightFactor, double? widthFactor}) → Align

Available on Widget, provided by the WidgetsExtension extension

alignAtCenterLeft({Key? key, double? heightFactor, double? widthFactor}) → Align

Available on Widget, provided by the WidgetsExtension extension

alignAtCenterRight({Key? key, double? heightFactor, double? widthFactor}) → Align

Available on Widget, provided by the WidgetsExtension extension

alignAtLERP(Alignment a, Alignment b, double t, {Key? key, double? heightFactor, double? widthFactor}) → Align

Available on Widget, provided by the WidgetsExtension extension

alignAtTopCenter({Key? key, double? heightFactor, double? widthFactor}) → Align

Available on Widget, provided by the WidgetsExtension extension

alignAtTopLeft({Key? key, double? heightFactor, double? widthFactor}) → Align

Available on Widget, provided by the WidgetsExtension extension

alignAtTopRight({Key? key, double? heightFactor, double? widthFactor}) → Align

Available on Widget, provided by the WidgetsExtension extension

alignXY(double x, double y, {Key? key, double? heightFactor, double? widthFactor}) → Align

Available on Widget, provided by the WidgetsExtension extension

build(BuildContext context) → Widget
Describes the part of the user interface represented by this widget.
override
card({Color? backgroundColor, double? elevation, EdgeInsets? margin}) → Widget

Available on Widget, provided by the WidgetsExtension extension

container({double? width, double? height, Alignment? alignment, Color? backgroundColor, double borderWidth = 1, double radius = 1, Color borderColor = Colors.transparent, EdgeInsets? padding, EdgeInsets? margin, BoxConstraints? constraints}) → Widget

Available on Widget, provided by the WidgetsExtension extension

createElement() → StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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
expanded({int flex = 1}) → Widget

Available on Widget, provided by the WidgetsExtension extension

fadeSlideIn({int milliseconds = 1000, double offset = 24}) → Widget

Available on Widget, provided by the WidgetsExtension extension

fit({Alignment alignment = Alignment.center}) → Widget

Available on Widget, provided by the WidgetsExtension extension

form(GlobalKey<FormState> key) → Widget

Available on Widget, provided by the WidgetsExtension extension

ltr() → Widget

Available on Widget, provided by the WidgetsExtension extension

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onDoubleTap(GestureTapCallback? onPressed) → Widget

Available on Widget, provided by the WidgetsExtension extension

onLongPress(GestureTapCallback? onPressed) → Widget

Available on Widget, provided by the WidgetsExtension extension

onPress(VoidCallback onTap, {double pressedScale = 0.9, Duration duration = const Duration(milliseconds: 120)}) → Widget

Available on Widget, provided by the WidgetsExtension extension

onTap(GestureTapCallback? onPressed) → Widget

Available on Widget, provided by the WidgetsExtension extension

onTapInk(GestureTapCallback? onPressed) → Widget

Available on Widget, provided by the WidgetsExtension extension

pAll(double padding) → Widget

Available on Widget, provided by the WidgetsExtension extension

pOnly({double left = 0.0, double top = 0.0, double right = 0.0, double bottom = 0.0}) → Widget

Available on Widget, provided by the WidgetsExtension extension

position({double? left, double? top, double? right, double? bottom, double? width, double? height}) → Widget

Available on Widget, provided by the WidgetsExtension extension

pSymmetric({double horizontal = 0.0, double vertical = 0.0}) → Widget

Available on Widget, provided by the WidgetsExtension extension

rotate(double scale) → Widget

Available on Widget, provided by the WidgetsExtension extension

rtl() → Widget

Available on Widget, provided by the WidgetsExtension extension

safeArea() → Widget

Available on Widget, provided by the WidgetsExtension extension

scale(double scale) → Widget

Available on Widget, provided by the WidgetsExtension extension

scrollable({Axis scrollDirection = Axis.vertical}) → Widget

Available on Widget, provided by the WidgetsExtension extension

showMenus(List<PopupMenuEntry<int>> items) → Widget

Available on Widget, provided by the WidgetsExtension extension

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
translate(Offset offset) → Widget

Available on Widget, provided by the WidgetsExtension extension

Operators

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

Static Methods

open({String? title, List<BarcodeFormat> formats = const <BarcodeFormat>[], String? hintText, bool showGalleryButton = false}) → Future<String?>
Push this page and await the scanned string (or null if dismissed).