SparkScan View

Defined in library scandit_datacapture_barcode_spark_ui

Note

The SparkScanView APIs are still in beta and may change in future versions of Scandit Data Capture SDK.

SparkScanScanningBehavior

Added in version 6.20.0

The capture mode type of the SparkScanView.

single

Added in version 6.20.0

Barcode capturing session is stopped after each scan.

continuous

Added in version 6.20.0

Keeps the barcode capturing session active for longer time.

SparkScanViewHandMode

Added in version 6.20.0

The hand mode type of the SparkScanView.

right

Added in version 6.20.0

Optimizes the layout for right-hand use of the SparkScanView.

left

Added in version 6.20.0

Optimizes the layout for left-hand use of the SparkScanView.

SparkScanScanningPrecision

Added in version 6.20.0

The scanning precision type of the SparkScanView.

defaultPrecision

Added in version 6.20.0

Default precision. Depending on the configured scanning mode and behavior, it results in the following behaviors:

SparkScanScanningModeDefault

SparkScanScanningModeTarget

SparkScanScanningBehavior.single

  • Tapping the trigger button starts the camera and the scanning process.

  • A barcode is scanned as soon as it is visible on the camera frame.

  • After a successful scan, the scanning process is stopped, and the camera is frozen on the last frame.

  • Tapping the trigger button starts the camera and the scanning process.

  • A barcode is scanned after pointing the viewfinder at it for a short time.

  • After a successful scan, the scanning process is stopped, and the camera is frozen on the last frame.

SparkScanScanningBehavior.continuous

  • Tapping the trigger button starts the camera and the scanning process.

  • A barcode is scanned as soon as it is visible on the camera frame.

  • Camera and scanning process keep running until the user taps the trigger button, or the SparkScanViewSettings.continuousCaptureTimeout expires.

  • Tapping the trigger button starts the camera and the scanning process.

  • A barcode is scanned after pointing the viewfinder at it for a short time.

  • Camera and scanning process keep running until the user taps the trigger button, or the SparkScanViewSettings.continuousCaptureTimeout expires.

accurate

Added in version 6.20.0

Accurate precision. Depending on the configured scanning mode and behavior, it results in the following behaviors:

SparkScanScanningModeDefault

SparkScanScanningModeTarget

SparkScanScanningBehavior.single

  • Expanding the trigger button starts the camera, and tapping it starts the scanning process.

  • A barcode is scanned after pointing the viewfinder at it.

  • After a successful scan, the scanning process is stopped, but the camera keeps running.

  • Tapping the trigger button starts the camera and the scanning process.

  • A barcode is scanned after pointing the viewfinder at it and tapping the trigger button.

  • Camera and scanning process keep running until the trigger button is collapsed.

SparkScanScanningBehavior.continuous

  • Expanding the trigger button starts the camera, and tapping it starts the scanning process.

  • A barcode is scanned after pointing the viewfinder at it.

  • Camera and scanning process keep running until the user taps the trigger button, or the SparkScanViewSettings.continuousCaptureTimeout expires.

  • Expanding the trigger button starts the camera, and tapping it starts the scanning process.

  • A barcode is scanned after pointing the viewfinder at it for a short time.

  • Camera and scanning process keep running until the user taps the trigger button, or the SparkScanViewSettings.continuousCaptureTimeout expires.

SparkScanViewUiListener
abstract class SparkScanViewUiListener

Added in version 6.20.0

didTapFastFindButton(view)
void didTapFastFindButton(SparkScanView view)

Added in version 6.20.0

Callback method that can be used to define an action that should be performed when fast find button is tapped from the toolbar. Called from the main thread.

didTapBarcodeCountButton(view)
void didTapBarcodeCountButton(SparkScanView view)

Added in version 6.20.0

Callback method that can be used to define an action that should be performed when barcode count button is tapped from the toolbar. Called from the main thread.

SparkScanScanningMode
abstract class SparkScanScanningMode

Added in version 6.20.0

The base class for setting a default scanning mode to SparkScanViewSettings. Can be either SparkScanScanningModeTarget or SparkScanScanningModeDefault.

SparkScanScanningModeTarget
class SparkScanScanningModeTarget : SparkScanScanningMode

Added in version 6.20.0

Target scanning mode. This is meant and optimized to scan codes further away.

SparkScanScanningModeTarget(scanningBehavior, scanningPrecision)
SparkScanScanningModeTarget(SparkScanScanningBehavior scanningBehavior,
        SparkScanScanningPrecision scanningPrecision)

Added in version 6.20.0

Constructs a new target scanning mode with the provided capture mode and scanning precision.

scanningBehavior
SparkScanScanningBehavior get scanningBehavior

Added in version 6.20.0

The scanning mode provided in the constructor.

scanningPrecision
SparkScanScanningPrecision get scanningPrecision

Added in version 6.20.0

The scanning precision provided in the constructor.

SparkScanScanningModeDefault
class SparkScanScanningModeDefault : SparkScanScanningMode

Added in version 6.20.0

This is the standard scanning mode for SparkScan.

SparkScanScanningModeDefault(scanningBehavior, scanningPrecision)
SparkScanScanningModeDefault(SparkScanScanningBehavior scanningBehavior,
        SparkScanScanningPrecision scanningPrecision)

Added in version 6.20.0

Constructs a new default scanning mode with the provided capture mode and scanning precision.

scanningBehavior
SparkScanScanningBehavior get scanningBehavior

Added in version 6.20.0

The scanning mode provided in the constructor.

scanningPrecision
SparkScanScanningPrecision get scanningPrecision

Added in version 6.20.0

The scanning precision provided in the constructor.

SparkScanView
class SparkScanView : StatefulWidget

Added in version 6.20.0

SparkScan comes with a ready-to-use UI and scanning modes that are purpose-built to tackle high-volume scanning at close range. The SparkScanView integrates with any app without requiring app redesign or customization. It includes:

  • camera preview screen

  • large-sized scan button

  • quick access toolbar to adjust scanning settings

onPause()
void onPause()

Added in version 6.20.0

Function to call when the AppLifecycleState in didChangeAppLifecycleState callback will be different then AppLifecycleState.resumed. You have to call this for the correct functioning of the SparkScanView. Read about the WidgetsBindingObserver <https://api.flutter.dev/flutter/widgets/WidgetsBindingObserver-class.html>.

@override
void didChangeAppLifecycleState(AppLifecycleState state) {
  if (state != AppLifecycleState.resumed) {
     sparkScanView.onPause();
  }
}
emitFeedback(feedback)
Future<void> emitFeedback(SparkScanViewFeedback feedback)

Added in version 6.20.0

Displays the SparkScanViewFeedback feedback and emits a SparkScanFeedback based on the feedback type.

hardwareTriggerSupported
static bool get hardwareTriggerSupported

Added in version 6.20.0

Returns whether the device supports listening for hardware button events. This is true for devices with api >= 28.

Note

This method is only supported on Android devices.

SparkScanView.forContext(child, dataCaptureContext, sparkScan, settings)
SparkScanView.forContext(Widget child,
        DataCaptureContext dataCaptureContext,
        SparkScan sparkScan,
        SparkScanViewSettings? settings)

Added in version 6.20.0

Constructs a new SparkScan view and adds it to the provided parentView. When the settings are provided, those will be used to set the default behaviour and look of the view.

SparkScanView.forContext(YOUR_WIDGET_TREE_BODY, dataCaptureContext, sparkScan, viewSettings);
startScanning()
Future<void> startScanning()

Added in version 6.20.0

Starts the scanning process. You can call this method if you want to trigger the scanning process without any user interaction.

pauseScanning()
Future<void> pauseScanning()

Added in version 6.20.0

Pauses the scanning process. You can call this method if you want to trigger pausing the scanning process without any user interaction.

setListener(listener)
void setListener(SparkScanViewUiListener? listener)

Added in version 6.20.0

Sets the listener which is called whenever a fast find button or barcode count button is tapped from the toolbar.

showToast(text)
Future<void> showToast(String text)

Added in version 6.20.0

Shows a toast with text inside the capture button.

shouldShowScanAreaGuides
bool shouldShowScanAreaGuides

Added in version 6.20.0

Whether to show scan area guides on top of the preview. This property is useful during development to visualize the current scan areas on screen. It is not meant to be used for production. By default this property is false.

brush
Brush brush

Added in version 6.20.0

The brush used for visualizing captured barcodes in the UI. To turn off drawing of locations, set the brush to use both a transparent fill and stroke color. By default, the brush has a transparent fill color, a white stroke color, and a stroke width of 1.

defaultBrush
static Brush get defaultBrush

Added in version 6.20.0

Returns the default brush used by the overlay.

barcodeCountButtonVisible
bool barcodeCountButtonVisible

Added in version 6.20.0

Indicates whether the barcode count button should be shown to the user.

Default is false.

fastFindButtonVisible
bool fastFindButtonVisible

Added in version 6.20.0

Indicates whether the fast find button should be shown to the user.

Default is false.

targetModeButtonVisible
bool targetModeButtonVisible

Added in version 6.20.0

Indicates whether the target mode button should be shown to the user.

Default is true.

scanningBehaviorButtonVisible
bool scanningBehaviorButtonVisible

Added in version 6.20.0

Indicates whether the scanning behavior button should be shown to the user.

Default is false.

torchButtonVisible
bool torchButtonVisible

Added in version 6.20.0

Indicates whether the torch button should be shown to the user.

Default is true.

soundModeButtonVisible
bool soundModeButtonVisible

Added in version 6.20.0

Indicates whether the enable sound button should be shown to the user.

Default is false.

hapticModeButtonVisible
bool hapticModeButtonVisible

Added in version 6.20.0

Indicates whether the enable haptic button should be shown to the user.

Default is false.

handModeButtonVisible
bool handModeButtonVisible

Added in version 6.20.0

Indicates whether the hand mode button should be shown to the user.

Default is false.

zoomSwitchControlVisible
bool zoomSwitchControlVisible

Added in version 6.20.0

Indicates whether the zoom switch control should be shown to the user.

Default is true.

stopCapturingText
String? stopCapturingText

Added in version 6.20.0

Sets the default text to display in the button for the stop capturing action.

Default is null.

startCapturingText
String? startCapturingText

Added in version 6.20.0

Sets the default text to display in the button for the start capturing action.

Default is null.

resumeCapturingText
String? resumeCapturingText

Added in version 6.20.0

Sets the default text to display in the button for the resume capturing action.

Default is null.

scanningCapturingText
String? scanningCapturingText

Added in version 6.20.0

Sets the default text to display in the button when scanning in SparkScanScanningBehavior.single.

Default is null.

captureButtonBackgroundColor
Color? captureButtonBackgroundColor

Added in version 6.20.0

Sets the background color of the capture button.

Default is null.

captureButtonActiveBackgroundColor
Color? captureButtonActiveBackgroundColor

Added in version 6.20.0

Sets the background color of the capture button when scanning.

Default is null.

captureButtonTintColor
Color? captureButtonTintColor

Added in version 6.20.0

Sets the capture button icon and text color.

Default is null.

toolbarBackgroundColor
Color? toolbarBackgroundColor

Added in version 6.20.0

Sets the toolbar background color.

Default is null.

toolbarIconActiveTintColor
Color? toolbarIconActiveTintColor

Added in version 6.20.0

Sets the toolbar icon active color.

Default is null.

toolbarIconInactiveTintColor
Color? toolbarIconInactiveTintColor

Added in version 6.20.0

Sets the toolbar icon inactive color.

Default is null.

targetModeHintText
String? targetModeHintText

Added in version 6.20.0

Sets the target mode hint text.

Default is null.

shouldShowTargetModeHint
bool shouldShowTargetModeHint

Added in version 6.20.0

Indicates whether hints in target mode should be shown to the user.

Default is true.

createState()
State<StatefulWidget> createState()

Added in version 6.20.0

Implemented from StatefulWidget. Called by the Flutter framework.