UScanner constructor
const
UScanner({
- ValueChanged<
String> ? onScan, - ValueChanged<
List< ? onCodes,UCode> > - void onScanError(
- Object error,
- StackTrace stackTrace
- UCameraController? controller,
- bool autoStart = true,
- UCameraFacing facing = UCameraFacing.back,
- UCameraResolution resolution = UCameraResolution.high,
- UCameraLens? lensType,
- UScanSpeed speed = UScanSpeed.normal,
- Duration dedupeWindow = const Duration(milliseconds: 1500),
- List<
UCodeFormat> formats = const <UCodeFormat>[], - UScanEngine engine = UScanEngine.auto,
- bool torchEnabled = false,
- bool tryInvert = false,
- bool autoZoom = false,
- double? initialZoom,
- BoxFit fit = BoxFit.cover,
- Widget errorBuilder(
- BuildContext context,
- UCameraException error
- WidgetBuilder? placeholderBuilder,
- LayoutWidgetBuilder? overlayBuilder,
- Rect? scanWindow,
- bool restrictToScanWindow = true,
- bool useAppLifecycleState = true,
- bool tapToFocus = true,
- bool pinchToZoom = true,
- 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),
- bool showTrackingBoxes = false,
- 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,
- bool showZoomSlider = 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,
Implementation
const UScanner({
this.onScan,
this.onCodes,
this.onScanError,
this.controller,
this.autoStart = true,
this.facing = UCameraFacing.back,
this.resolution = UCameraResolution.high,
this.lensType,
this.speed = UScanSpeed.normal,
this.dedupeWindow = const Duration(milliseconds: 1500),
this.formats = const <UCodeFormat>[],
this.engine = UScanEngine.auto,
this.torchEnabled = false,
this.tryInvert = false,
this.autoZoom = false,
this.initialZoom,
this.fit = BoxFit.cover,
this.errorBuilder,
this.placeholderBuilder,
this.overlayBuilder,
this.scanWindow,
this.restrictToScanWindow = true,
this.useAppLifecycleState = true,
this.tapToFocus = true,
this.pinchToZoom = true,
this.singleScan = true,
this.hapticOnScan = true,
this.showOverlay = true,
this.overlayColor,
this.scanWindowSize = const Size(280, 280),
this.borderColor,
this.borderWidth = 3,
this.borderRadius = 16,
this.cornerLength = 32,
this.showCorners = true,
this.showFullBorder = false,
this.showScanLine = true,
this.scanLineColor,
this.scanLineThickness = 2,
this.scanLineDuration = const Duration(seconds: 2),
this.showTrackingBoxes = false,
this.hintText,
this.showHint = true,
this.hintTextStyle,
this.hintPosition = UScannerHintPosition.bottom,
this.hintGap = 20,
this.hintPadding = const EdgeInsets.symmetric(horizontal: 14, vertical: 10),
this.hintBackgroundColor,
this.hintBorderRadius = 12,
this.showControls = true,
this.showTorchButton = true,
this.showSwitchCameraButton = true,
this.showGalleryButton = false,
this.showZoomSlider = false,
this.controlsAlignment = Alignment.bottomCenter,
this.controlsSpacing = 24,
this.controlsPadding = const EdgeInsets.only(bottom: 40),
this.controlIconColor,
this.controlActiveIconColor,
this.controlBackgroundColor,
this.controlButtonSize = 52,
this.controlIconSize = 26,
this.torchOnIcon = Icons.flash_on_rounded,
this.torchOffIcon = Icons.flash_off_rounded,
this.switchCameraIcon = Icons.cameraswitch_rounded,
this.galleryIcon = Icons.photo_library_rounded,
super.key,
});