UScanner constructor

const UScanner({
  1. ValueChanged<String>? onScan,
  2. ValueChanged<List<UCode>>? onCodes,
  3. void onScanError(
    1. Object error,
    2. StackTrace stackTrace
    )?,
  4. UCameraController? controller,
  5. bool autoStart = true,
  6. UCameraFacing facing = UCameraFacing.back,
  7. UCameraResolution resolution = UCameraResolution.high,
  8. UCameraLens? lensType,
  9. UScanSpeed speed = UScanSpeed.normal,
  10. Duration dedupeWindow = const Duration(milliseconds: 1500),
  11. List<UCodeFormat> formats = const <UCodeFormat>[],
  12. UScanEngine engine = UScanEngine.auto,
  13. bool torchEnabled = false,
  14. bool tryInvert = false,
  15. bool autoZoom = false,
  16. double? initialZoom,
  17. BoxFit fit = BoxFit.cover,
  18. Widget errorBuilder(
    1. BuildContext context,
    2. UCameraException error
    )?,
  19. WidgetBuilder? placeholderBuilder,
  20. LayoutWidgetBuilder? overlayBuilder,
  21. Rect? scanWindow,
  22. bool restrictToScanWindow = true,
  23. bool useAppLifecycleState = true,
  24. bool tapToFocus = true,
  25. bool pinchToZoom = true,
  26. bool singleScan = true,
  27. bool hapticOnScan = true,
  28. bool showOverlay = true,
  29. Color? overlayColor,
  30. Size scanWindowSize = const Size(280, 280),
  31. Color? borderColor,
  32. double borderWidth = 3,
  33. double borderRadius = 16,
  34. double cornerLength = 32,
  35. bool showCorners = true,
  36. bool showFullBorder = false,
  37. bool showScanLine = true,
  38. Color? scanLineColor,
  39. double scanLineThickness = 2,
  40. Duration scanLineDuration = const Duration(seconds: 2),
  41. bool showTrackingBoxes = false,
  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. bool showZoomSlider = false,
  55. Alignment controlsAlignment = Alignment.bottomCenter,
  56. double controlsSpacing = 24,
  57. EdgeInsets controlsPadding = const EdgeInsets.only(bottom: 40),
  58. Color? controlIconColor,
  59. Color? controlActiveIconColor,
  60. Color? controlBackgroundColor,
  61. double controlButtonSize = 52,
  62. double controlIconSize = 26,
  63. IconData torchOnIcon = Icons.flash_on_rounded,
  64. IconData torchOffIcon = Icons.flash_off_rounded,
  65. IconData switchCameraIcon = Icons.cameraswitch_rounded,
  66. IconData galleryIcon = Icons.photo_library_rounded,
  67. 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,
});