ThemeReader class final
Reads the properties of one component (components.card.*) by
Flutter's own property names in camel case (backgroundColor is
background-color in the files), parsing each by its type: colors,
shapes, border sides, insets, text styles, numbers, enums, durations,
cursors, and a value per state for those Flutter models as a
WidgetStateProperty. A component's mapping is its constructor call
written with these readers, so adding a property is one line.
The reader remembers every property it was asked for, which gives the list of valid keys: checkUnknown fails the start for any other key present, naming the valid ones. Internal to the starter.
Constructors
- ThemeReader({required SpringThemeData theme, required ThemeProperties properties, required String root, required String label, required TextStyle namedStyle(String name), String? shapeToken, bool topShape = false})
-
A reader of the properties below
root(a canonical path such ascomponents.card), whose component is calledlabelin messages.shapeTokenis the Material 3 shape token the component'sshapefollows when the theme changed it;topShaperounds the top corners only.
Properties
-
asked
→ List<
ThemeProperty> -
The properties asked for so far, in the order of the asking
(nested ones as
style.background-color).no setter - has → bool
-
Whether the component is themed: it has properties, or follows a
shape token the theme changed.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- label → String
-
The component's name in messages, in kebab case.
final
- namedStyle → TextStyle Function(String name)
-
The text style the theme calls
name(title-large,code).final - properties → ThemeProperties
-
The theme's resolved properties.
final
- root → String
-
The canonical path of the component (
components.card).final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shapeToken → String?
-
The Material 3 shape token the
shapeproperty follows.final - theme → SpringThemeData
-
The theme the values refer to (color roles, shape tokens, ...).
final
- topShape → bool
-
Whether
shaperounds the top corners only.final
Methods
-
alignment(
String name) → AlignmentGeometry? -
An alignment (
center,top-left,x, y). -
animation(
String name) → AnimationStyle? -
An animation style: a map of
durationandreverse-duration. -
borderRadius(
String name) → BorderRadius? - A corner radius or shape token for all four corners.
-
borderRadiusAt(
String path) → BorderRadius? -
The corner radius at
path, as borderRadius reads one. -
checkUnknown(
) → void - Fails with a ThemePropertyException for a key of the component that no reader asked for, naming the valid ones.
-
choice<
T extends Enum> (String name, List< T> values) → T? -
One of the
valuesof an enum, in kebab or camel case. -
color(
String name) → Color? - A color: a role, a Colors name or hex, with an optional opacity.
-
constraints(
String name) → BoxConstraints? -
Box constraints from
min-width,max-width,min-height,max-height. -
count(
String name) → int? - A whole number.
-
custom<
T> (String name, String kind, T? at(String path)) → T? -
A value of a kind this reader has no method for (a design's own: an
input border, an ink splash).
atreads it at the property's path with leaf, keys, kids, sideAt and borderRadiusAt;kindnames it in the reference of the properties. -
customStates<
T extends Object> (String name, String kind, T? at(String path)) → WidgetStateProperty< T?> ? - Like custom, or one value per state.
-
decoration(
String name) → Decoration? - A box decoration: a color, or a map of color, radius, border, shape.
-
duration(
String name) → Duration? -
A duration (
250ms,1s). -
elevation(
String name) → double? - An elevation: a level token or a number.
-
flag(
String name) → bool? -
trueorfalse. -
group(
String name) → ThemeReader -
A reader of the nested group
name(input-decoration,cancel-button-style), whose keys are checked with the component's. -
icon(
String name) → IconThemeData? - An icon theme: a color or a map of color, size, fill, weight, grade, optical-size and opacity.
-
iconFields(
) → IconThemeData? -
The icon theme whose properties are the component's own, not under
one name:
color,size,fill,weight,grade,optical-size,opacity. -
insets(
String name) → EdgeInsets? -
Insets (
8,16, 8,1, 2, 3, 4, or a map), or per state. -
keys(
String path, Set< String> allowed, String what) → Set<String> -
The keys of the map at
path, each of which must be one ofallowed;whatnames the map in the error. -
kids(
String path) → Set< String> -
The keys of the map at
path; empty for a single value. -
leaf<
T> (String path, T? parse(String raw), String expected) → T? -
The single value at
path, parsed byparse;nullwhen it is not set. Throws a ThemePropertyException sayingexpectedwhenparsegivesnullor the property is a map. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
number(
String name) → double? - A number.
-
offset(
String name) → Offset? -
An offset (
x, y). -
overlayStyle(
String name) → SystemUiOverlayStyle? -
The overlay style of the status bar:
lightordark. -
radius(
String name) → Radius? - A corner radius.
-
shape(
String name, {bool? top}) → OutlinedBorder? -
A shape: a token, a radius,
stadium,circleor a map. The property calledshapefollows the component's shape token. -
side(
String name) → BorderSide? - A border side: a color, or a map of color, width, style and stroke-align.
-
sideAt(
String path) → BorderSide? -
The border side at
path, as side reads one. -
size(
String name) → Size? -
A size (
48,64, 48, or a map). -
stateColor(
String name) → WidgetStateProperty< Color?> ? - A color, or a color per state.
-
stateCursor(
String name) → WidgetStateProperty< MouseCursor?> ? -
A mouse cursor by name (
click,forbidden), or one per state. -
stateElevation(
String name) → WidgetStateProperty< double?> ? - An elevation, or one per state.
-
stateFlag(
String name) → WidgetStateProperty< bool?> ? -
trueorfalse, or one per state. -
stateIcon(
String name) → WidgetStateProperty< IconThemeData?> ? - An icon theme, or one per state.
-
stateInsets(
String name) → WidgetStateProperty< EdgeInsetsGeometry?> ? - Insets, or insets per state.
-
stateNumber(
String name) → WidgetStateProperty< double?> ? - A number, or a number per state.
-
stateShape(
String name) → WidgetStateProperty< OutlinedBorder?> ? - A shape, or a shape per state.
-
stateSide(
String name) → WidgetStateProperty< BorderSide?> ? - A border side, or one per state.
-
stateSize(
String name) → WidgetStateProperty< Size?> ? - A size, or a size per state.
-
stateText(
String name) → WidgetStateProperty< TextStyle?> ? - A text style, or one per state.
-
text(
String name, {TextStyle? base}) → TextStyle? - A text style: a named one or a map.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
parseNumber(
String raw) → double? -
rawas a number;nullwhen it is none.