ScannerTheme class final
Colors and shapes of the scanner widgets: the scan window, the buttons, the glass panels and the result sheets.
Every field is optional. A field left null takes the value of the
template's theme (see ScannerTemplate.theme), then the default:
BarcodeScanner(
template: ScannerTemplate.minimal(),
theme: ScannerTheme(
accent: Color(0xFFFF6A1A),
windowRadius: 6,
buttonShape: ScannerButtonShape.roundedSquare,
),
)
The text uses the app's font unless fontFamily is set. Read the resolved theme in your own overlay or sheet with ScannerTheme.of; its colors (lockColor, glassColor, inkColor, ...) and text styles (titleStyle, dataStyle, ...) follow the accent and brightness, and icons gives every icon of the built-in widgets.
- Mixed-in types
- Annotations
Constructors
- ScannerTheme({Color? accent, Brightness? brightness, double? windowRadius, ScannerButtonShape? buttonShape, bool? blur, bool? scrimBlur, String? fontFamily, String? monoFontFamily, Color? warning, Color? danger, Color? window, Color? scrim, double? bracketWidth, double? bracketLength, ScannerWindowShape? windowShape, bool? breathing, ScanLine? scanLine, ScannerWindowPicture? windowPicture, Color? glass, Color? sheet, double? sheetRadius, Color? outline, double? outlineWidth, ScannerTextStyles textStyles = const ScannerTextStyles(), ScannerIconSet icons = const ScannerIconSet()})
-
Creates a theme.
nullfields keep the value of the theme it is merged onto.const
Properties
- accent → Color?
-
The color of a code the scanner has locked on: the window brackets,
the outlines and the primary buttons. Text in this color is derived
from it with enough contrast (lockInkColor). Default
defaultAccent.
final
- blur → bool?
-
Whether the glass panels blur the camera behind them; without blur
they are more opaque. Left
null, the scanner blurs, and stops for good when, in its first three seconds, the device has no room for it (one frame in ten over 8 ms, or five over 16 ms), as on a 2020 Android phone.trueblurs always,falsenever.final - bodyStyle → TextStyle
-
Body text.
no setter
- bracketLength → double?
-
Length of each bracket's straight arm, in logical pixels, after the
rounded corner.
nullmakes it 22 % of the window's shorter side, from 12 to 44. On a code smaller than the brackets, the arms meet.final - bracketWidth → double?
-
Line width of the window's brackets, in logical pixels. Default 5.
final
- breathing → bool?
-
Whether the window's brackets breathe while the scanner searches.
falsekeeps them still. Defaulttrue; off with the platform's reduce motion setting.final - brightness → Brightness?
-
Light or dark glass.
nullfollows the platform's brightness.final -
Shape of a 48 dp button.
no setter
-
Shape of the buttons and panels. Default ScannerButtonShape.circle.
final
- chipStyle → TextStyle
-
Symbology chips ("QR Code").
no setter
- danger → Color?
-
The color of a code that is refused (
ScanVerdict.reject) and of problems such as an expiry date that has passed. Default a bright red.final - dangerColor → Color
-
A refused code and problems (danger).
no setter
- dangerInkColor → Color
-
Text in the danger's hue on glass, such as "Expired".
no setter
- dataStyle → TextStyle
-
Barcode data: payloads and codes.
no setter
- displayStyle → TextStyle
-
Large numbers, such as an amount.
no setter
- focusColor → Color
-
The keyboard focus ring.
no setter
- fontFamily → String?
-
Font of the scanner's text.
nulluses the app's font.final - glass → Color?
-
The background of the buttons, hints and title pills over the camera,
such as your brand's color. An opaque color is drawn without the blur
behind it, which saves its cost; a translucent one keeps the blur
unless blur is off. Default a light or dark glass (glassColor).
final
- glassColor → Color
-
Buttons, hints and title pills (glass).
no setter
- glassEdgeColor → Color
-
The light edge along the top of glass.
no setter
- glassFilter → ImageFilter?
-
The blur behind glass, or
nullwithout blur.no setter - hashCode → int
-
The hash code for this object.
no setteroverride
- hintStyle → TextStyle
-
Hints and title pills.
no setter
- icons → ScannerIconSet
-
Icons of the built-in buttons and sheets, such as your icon font's:
final
- inkColor → Color
-
Primary text.
no setter
- inkMutedColor → Color
-
Secondary text.
no setter
- isDark → bool
-
Whether the glass is dark.
no setter
- labelStyle → TextStyle
-
Buttons.
no setter
- lineColor → Color
-
Outlines of secondary buttons and separators.
no setter
- lockColor → Color
-
The accent: brackets and outlines of a locked code, primary buttons.
no setter
- lockInkColor → Color
-
Text and icons in the accent's hue on glass and on lockSoftColor,
with a contrast of at least 4.5:1.
no setter
- lockSoftColor → Color
-
The accent, faint: the fill of outlines, chips and badges.
no setter
- monoFontFamily → String?
-
Font of barcode data (payloads, codes, symbology identifiers).
nulluses a monospaced system font.final - mutedStyle → TextStyle
-
Secondary body text.
no setter
- onDangerColor → Color
-
Text and icons on dangerColor.
no setter
- onLockColor → Color
-
Text and icons on lockColor.
no setter
- onSignalColor → Color
-
Text and icons on signalColor.
no setter
- onWarningColor → Color
-
Text and icons on warningColor.
no setter
- outline → Color?
-
The outlines of the codes in view, as in ScannerMode.pick or a
scanner without a window. Default the accent (outlineColor).
final
- outlineColor → Color
-
The outlines of the codes in view (outline).
no setter
- outlineFillColor → Color
-
The faint fill inside the outlines of the codes in view.
no setter
- outlineWidth → double?
-
Line width of the outlines of the codes in view, in logical pixels.
Default 3; 2 on a photo.
final
- overlineStyle → TextStyle
-
The small capitals above a title ("LINK", "PAYMENT REQUEST").
no setter
- pillBorder → ShapeBorder
-
Shape of hints, title pills, chips and action buttons.
no setter
- resolvedBlur → bool
-
Whether glass blurs what is behind it.
no setter
- resolvedBracketWidth → double
-
Line width of the window's brackets.
no setter
- resolvedBreathing → bool
-
Whether the brackets breathe while searching (before reduce motion).
no setter
- resolvedButtonShape → ScannerButtonShape
-
The buttons' and panels' shape.
no setter
- resolvedOutlineWidth → double
-
Line width of the outlines of the codes in view.
no setter
- resolvedScanLine → ScanLine?
-
The scan line, or
nullfor none (ScanLine.none included).no setter - resolvedScrimBlur → bool
-
Whether the dimmed camera around the scan window is blurred.
no setter
- resolvedWindowPicture → ScannerWindowPicture
-
What the window shows of the code found.
no setter
- resolvedWindowRadius → double
-
The scan window's corner radius.
no setter
- resolvedWindowShape → ScannerWindowShape
-
The scan window's shape.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scanLine → ScanLine?
-
A line that runs across the window while the scanner searches, like a
laser. Default none; ScanLine.none turns off one of the theme
merged under.
final
- scrim → Color?
-
The dimmed camera around the scan window, such as
Color(0xB3000000)for a darker one or a tint of your brand. Default a translucent black that depends on the brightness (scrimColor).final - scrimBlur → bool?
-
Whether the dimmed camera around the scan window is also blurred. The
blur is computed again for every camera frame. Left
null, the scanner blurs, and stops for good when the device does not draw its frames in time, like blur.trueblurs always,falsenever.final - scrimColor → Color
-
The dimmed camera outside the scan window (scrim).
no setter
- shadowColor → Color
-
The shadow under glass.
no setter
- sheet → Color?
-
The background of the result sheets and cards, such as
Color(0xFFFFFFFF)for a plain white one. An opaque color is drawn without the blur behind it, as for glass. Default a more opaque glass (sheetColor).final - sheetBorder → ShapeBorder
-
Shape of the result sheets and cards.
no setter
- sheetColor → Color
-
Sheets and cards: the more opaque glass that text sits on (sheet).
no setter
- sheetRadius → double?
-
The corner radius of the result sheets and cards, in logical pixels.
nullgives 32 at the top and 24 at the bottom, or 20 with ScannerButtonShape.roundedSquare buttons (sheetBorder).final - signalColor → Color
-
A control that is on, such as the torch.
no setter
- signalInkColor → Color
-
Text in the signal's hue, such as a warning.
no setter
- textStyles → ScannerTextStyles
-
Changes to the text styles, merged onto the built-in ones, such as a
larger hint or a bolder title. The fontFamily applies under them.
final
- titleStyle → TextStyle
-
Sheet titles: a merchant, a network, a link's host.
no setter
- warning → Color?
-
The color of a code that needs a look, such as a ticket already
checked in (
ScanVerdict.warn). Default signalColor, amber.final - warningColor → Color
-
A code that needs a look (warning).
no setter
- window → Color?
-
The color of the scan window's brackets while the scanner searches;
on a code they take the accent. Default white (windowColor).
final
- windowBorder → ShapeBorder
-
Shape of the scan window as drawn: a rounded rectangle, or an oval for
ScannerWindowShape.circle. Its
getOuterPathgives the window's outline, for a window of your own.no setter - windowColor → Color
-
The scan window's brackets while searching (window).
no setter
- windowPicture → ScannerWindowPicture?
-
What the window shows of the code found: drawn exactly where it can
be (ScannerWindowPicture.exact, the default), always the camera's
cut-out (ScannerWindowPicture.photo), or nothing
(ScannerWindowPicture.none).
final
- windowRadius → double?
-
Corner radius of the scan window, in logical pixels. Default 24.
final
- windowShape → ScannerWindowShape?
-
Shape of the scan window: ScannerWindowShape.rounded (the default),
a ScannerWindowShape.circle, or ScannerWindowShape.bracketsOnly
without the scrim. The scrim's cut-out, the brackets and the
scanLine follow it; the camera is decoded in the window's rectangle
whatever its shape.
final
Methods
-
copyWith(
{Color? accent, Brightness? brightness, double? windowRadius, ScannerButtonShape? buttonShape, bool? blur, bool? scrimBlur, String? fontFamily, String? monoFontFamily, Color? warning, Color? danger, Color? window, Color? scrim, double? bracketWidth, double? bracketLength, ScannerWindowShape? windowShape, bool? breathing, ScanLine? scanLine, ScannerWindowPicture? windowPicture, Color? glass, Color? sheet, double? sheetRadius, Color? outline, double? outlineWidth, ScannerTextStyles? textStyles, ScannerIconSet? icons}) → ScannerTheme - A copy with the given fields replaced.
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
override
-
merge(
ScannerTheme? other) → ScannerTheme -
This theme with the non-null fields of
otheron top. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringShort(
) → String -
A brief description of this object, usually just the runtimeType and the
hashCode.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Methods
-
of(
BuildContext context) → ScannerTheme - The theme of the nearest ScannerScope, or the default theme; without a brightness, the platform's (light where unknown).
Constants
- defaultAccent → const Color
- The accent of the default theme, a bright teal.