UScanner constructor

const UScanner({
  1. ValueChanged<String>? onScan,
  2. ValueChanged<BarcodeCapture>? onCapture,
  3. ValueChanged<List<Barcode>>? onBarcodes,
  4. void onScanError(
    1. Object error,
    2. StackTrace stackTrace
    )?,
  5. MobileScannerController? controller,
  6. bool autoStart = true,
  7. Size? cameraResolution,
  8. CameraLensType lensType = CameraLensType.any,
  9. DetectionSpeed detectionSpeed = DetectionSpeed.normal,
  10. int detectionTimeoutMs = 250,
  11. CameraFacing facing = CameraFacing.back,
  12. List<BarcodeFormat> formats = const <BarcodeFormat>[],
  13. bool returnImage = false,
  14. bool torchEnabled = false,
  15. bool invertImage = false,
  16. bool autoZoom = false,
  17. double? initialZoom,
  18. BoxFit fit = BoxFit.cover,
  19. Widget errorBuilder(
    1. BuildContext,
    2. MobileScannerException
    )?,
  20. WidgetBuilder? placeholderBuilder,
  21. LayoutWidgetBuilder? overlayBuilder,
  22. Rect? scanWindow,
  23. bool restrictToScanWindow = false,
  24. double scanWindowUpdateThreshold = 0.0,
  25. bool useAppLifecycleState = true,
  26. bool tapToFocus = false,
  27. bool singleScan = true,
  28. bool hapticOnScan = true,
  29. bool showOverlay = true,
  30. Color? overlayColor,
  31. Size scanWindowSize = const Size(280, 280),
  32. Color? borderColor,
  33. double borderWidth = 3,
  34. double borderRadius = 16,
  35. double cornerLength = 32,
  36. bool showCorners = true,
  37. bool showFullBorder = false,
  38. bool showScanLine = true,
  39. Color? scanLineColor,
  40. double scanLineThickness = 2,
  41. Duration scanLineDuration = const Duration(seconds: 2),
  42. String? hintText,
  43. bool showHint = true,
  44. TextStyle? hintTextStyle,
  45. UScannerHintPosition hintPosition = UScannerHintPosition.bottom,
  46. double hintGap = 20,
  47. EdgeInsets hintPadding = const EdgeInsets.symmetric(horizontal: 14, vertical: 10),
  48. Color? hintBackgroundColor,
  49. double hintBorderRadius = 12,
  50. bool showControls = true,
  51. bool showTorchButton = true,
  52. bool showSwitchCameraButton = true,
  53. bool showGalleryButton = false,
  54. Alignment controlsAlignment = Alignment.bottomCenter,
  55. double controlsSpacing = 24,
  56. EdgeInsets controlsPadding = const EdgeInsets.only(bottom: 40),
  57. Color? controlIconColor,
  58. Color? controlActiveIconColor,
  59. Color? controlBackgroundColor,
  60. double controlButtonSize = 52,
  61. double controlIconSize = 26,
  62. IconData torchOnIcon = Icons.flash_on_rounded,
  63. IconData torchOffIcon = Icons.flash_off_rounded,
  64. IconData switchCameraIcon = Icons.cameraswitch_rounded,
  65. IconData galleryIcon = Icons.photo_library_rounded,
  66. Key? key,
})

Implementation

const UScanner({
  this.onScan,
  this.onCapture,
  this.onBarcodes,
  this.onScanError,
  this.controller,
  this.autoStart = true,
  this.cameraResolution,
  this.lensType = CameraLensType.any,
  this.detectionSpeed = DetectionSpeed.normal,
  this.detectionTimeoutMs = 250,
  this.facing = CameraFacing.back,
  this.formats = const <BarcodeFormat>[],
  this.returnImage = false,
  this.torchEnabled = false,
  this.invertImage = false,
  this.autoZoom = false,
  this.initialZoom,
  this.fit = BoxFit.cover,
  this.errorBuilder,
  this.placeholderBuilder,
  this.overlayBuilder,
  this.scanWindow,
  this.restrictToScanWindow = false,
  this.scanWindowUpdateThreshold = 0.0,
  this.useAppLifecycleState = true,
  this.tapToFocus = false,
  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.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.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,
});