ScanWindow class final

The part of the camera preview that is decoded, relative to what the user sees on screen. The default overlay draws exactly this area.

A smaller window decodes faster and avoids reading neighbouring codes.

const ScanWindow.centered()                          // 70% wide square
const ScanWindow.centered(width: 0.9, aspectRatio: 3) // wide, for 1D codes
const ScanWindow.centered(alignment: Alignment(0, -0.5)) // higher up
const ScanWindow.full()
ScanWindow.fromRect(const Rect.fromLTWH(0.1, 0.2, 0.8, 0.3))
Annotations

Constructors

ScanWindow.centered({double width = 0.7, double aspectRatio = 1, Alignment alignment = Alignment.center})
A window in the centre: width as a fraction of the preview width, height from aspectRatio (width / height). On a preview too low for that, such as a phone in landscape, the window is shrunk to take the same fraction of the height.
const
ScanWindow.fromRect(Rect fractions)
A window given as fractions of the preview (0–1 on both axes).
const
ScanWindow.full()
The whole visible preview.
const

Properties

hashCode → int
The hash code for this object.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolve(Size viewSize) → Rect
The window in the coordinates of a preview of viewSize.
toString() → String
A string representation of this object.
inherited

Operators

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