Label Capture Basic Overlay

Defined in library scandit_datacapture_label_ui

LabelCaptureBasicOverlay
class LabelCaptureBasicOverlay : DataCaptureOverlay

Added in version 7.2.0

Overlay for label capture that provides visual feedback and customization capabilities for the scanning process. This overlay displays captured labels and their fields on top of the camera preview, offering extensive customization options through listener interfaces.

Key visualization features:

  • Label highlighting - Configurable visual feedback for detected labels

  • Field state indication - Different visual styles for predicted vs. captured fields

  • Custom brush configuration - Fully customizable appearance for labels and fields

  • Listener-based customization - Programmatic control over field appearances

The overlay distinguishes between different field states:

  • Predicted fields - Fields that have been detected but not yet captured

  • Captured fields - Fields that have been successfully scanned and validated

Advanced customization is available through LabelCaptureBasicOverlayListener, allowing dynamic styling based on field content, validation status, or other contextual information.,

Fields are highlighted using a default brush (capturedFieldBrush, predictedFieldBrush), a brush set through a user-defined LabelCaptureBasicOverlayListener or calls to setBrushForFieldOfLabel().

LabelCaptureBasicOverlay(mode)
 LabelCaptureBasicOverlay(LabelCapture mode)

Added in version 7.6.0

Construct a new LabelCaptureBasicOverlay. For the overlay to be displayed on screen, it must be added to a DataCaptureView.

LabelCaptureBasicOverlay.withLabelCapture(labelCapture, view)
factory LabelCaptureBasicOverlay.withLabelCapture(
        LabelCapture labelCapture,
        {DataCaptureView? view})

Added in version 7.2.0

Constructs a new overlay to visualize the process of label capture. When view is non-null, the overlay is automatically added to the view. Otherwise, the overlay needs to be added through a call to DataCaptureView.addOverlay().

Deprecated since version 7.6: This static function has been deprecated in favour of the new constructor LabelCaptureBasicOverlay().

listener
LabelCaptureBasicOverlayListener? listener

Added in version 7.2.0

setBrushForFieldOfLabel(brush, field, label)
Future<void> setBrushForFieldOfLabel(Brush? brush,
        LabelField field,
        CapturedLabel label)

Added in version 7.2.0

Sets a custom brush to visually highlight a specific field within a captured label. This allows for dynamic styling based on field content, validation status, or other contextual information.

Use this method to provide visual feedback for specific fields, such as highlighting errors, successful captures, or fields requiring attention.

This method is thread-safe; it can be called from any thread. When listener is set to a non-null instance, the listener continues to be asked for the brush to use for this field whenever the state changes, thereby replacing any brushes set by calling setBrushForFieldOfLabel().

setBrushForLabel(brush, label)
Future<void> setBrushForLabel(Brush? brush,
        CapturedLabel label)

Added in version 7.2.0

Sets a custom brush to visually highlight a specific captured label. This allows for dynamic styling of entire labels based on their completion status, validation results, or other contextual information.

Use this method to provide visual feedback for labels, such as highlighting complete vs. incomplete labels, or marking labels that require validation. This method is thread-safe; it can be called from any thread.

When listener is set to a non-null instance, the listener continues to be asked for the brush to use for this label whenever the state of one its fields changes, thereby replacing any brushes set by calling setBrushForLabel().

defaultPredictedFieldBrush
static Brush get defaultPredictedFieldBrush

Added in version 7.2.0

The default brush applied to predicted fields. This is the brush used if LabelCaptureBasicOverlayListener is not set.

defaultCapturedFieldBrush
static Brush get defaultCapturedFieldBrush

Added in version 7.2.0

The default brush applied to captured fields. This is the brush used if LabelCaptureBasicOverlayListener is not set.

defaultLabelBrush
static Brush get defaultLabelBrush

Added in version 7.2.0

The default brush used for drawing labels. This brush is used when no listener is set, or the LabelCaptureBasicOverlayListener.brushForLabel() returns a null brush.

predictedFieldBrush
Brush? predictedFieldBrush

Added in version 7.2.0

The brush applied to predicted fields if no LabelCaptureBasicOverlayListener is set.

capturedFieldBrush
Brush? capturedFieldBrush

Added in version 7.2.0

labelBrush
Brush? labelBrush

Added in version 7.2.0

shouldShowScanAreaGuides
bool shouldShowScanAreaGuides

Added in version 7.2.0

Controls whether scan area guides are displayed over the camera preview. These guides help visualize the active scanning regions during development and debugging.

This feature is intended for development purposes only and should not be enabled in production applications. By default this property is false.

viewfinder
Viewfinder? viewfinder

Added in version 7.2.0

The viewfinder used to guide users during the scanning process. The viewfinder provides visual cues about the optimal scanning area and helps users position labels correctly.

By default, no viewfinder is displayed. Set this to an instance of Viewfinder (such as RectangularViewfinder) to provide scanning guidance to users.

view
DataCaptureView? view

Added in version 7.2.0

The data capture view that this overlay is attached to. This property allows you to access the parent view for overlay management or to perform view-related operations.

Returns null when the overlay is not currently attached to any view.