BarcodeArResponsiveAnnotation class

Responsive annotations dynamically switch between different annotation variations based on the barcode’s size relative to the screen. This allows for different display styles as a barcode gets closer to or further from the camera.

Each variation is gated by an area-ratio upper bound (the barcode area as a percentage of the screen area). The variations are evaluated from far to close, and the one whose upper bound is the first at or above the current ratio is displayed.

Each variation is a BarcodeArAnnotation — an info, popover, status icon or custom annotation — and any can be set to null to display nothing in that range.

A BarcodeArResponsiveAnnotation passed as a variation is ignored with a warning.

A BarcodeArPopoverAnnotation is not fully supported as a variation. BarcodeArView only applies popover-specific handling — dark scrim, exclusive visibility, hiding on tap — to a popover the annotation provider returns directly, so a popover used as a variation does not receive it.

Added in version 8.2.0

Inheritance

Constructors

BarcodeArResponsiveAnnotation(Barcode _barcode, BarcodeArInfoAnnotation? closeUpAnnotation, BarcodeArInfoAnnotation? farAwayAnnotation)
Constructs a new responsive annotation with the given barcode and annotation variations.
BarcodeArResponsiveAnnotation.withAnnotationsByThreshold(Barcode _barcode, Map<double, BarcodeArAnnotation?> annotationsByThreshold)
Constructs a new responsive annotation whose displayed variation depends on the barcode's area relative to the view. Each key is the area-ratio upper bound (in the range (0.0, 1.0]) at or below which the associated annotation is shown; ranges are evaluated from far to close. A null value suppresses the annotation in that range. Keys outside (0.0, 1.0] are dropped with a warning.

Properties

annotationsByThreshold → Map<double, BarcodeArAnnotation?>
The annotations keyed by the area-ratio upper bound (in (0.0, 1.0]) at or below which each is shown, ordered by ascending threshold. A null value means no annotation is shown in that range.
no setter
annotationTrigger ↔ BarcodeArAnnotationTrigger
The trigger that causes the annotation to be presented. By default is BarcodeArAnnotationTrigger.highlightTapAndBarcodeScan.
getter/setter pairoverride
barcode → Barcode
The barcode instance for the annotation.
no setter
barcodeId ↔ String
getter/setter pairinherited
closeUpAnnotation → BarcodeArInfoAnnotation?
The annotation displayed when the barcode appears close-up (when the barcode area exceeds the BarcodeArResponsiveAnnotation.threshold).
no setter
controller ↔ BarcodeArViewController?
getter/setter pairinherited
farAwayAnnotation → BarcodeArInfoAnnotation?
The annotation displayed when the barcode appears far away (when the barcode area is below or equal to the BarcodeArResponsiveAnnotation.threshold).
no setter
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
threshold ↔ double
The threshold (percentage of the barcode area vs screen area) that determines when to display close-up vs far-away annotations.
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() → Map<String, dynamic>
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited