theme_design library
What a design library reads the themes of spring.flutter.theme.*
with: the properties of a theme, the reader of typed values, the scales
and the names of the text styles.
For the author of a ThemeDesign (the Material and Cupertino starters
are two); an application needs spring_boot_starter_flutter.dart only.
Classes
- ColorSchemeSpec
- What a theme's palette is made from when it is not Flutter's baseline: the seed color, the variant of the algorithm and the contrast.
- SpringColorScheme
-
The palette of a theme: one color per role (
primary,onSurface,outlineVariant), light or dark. - SpringTextSpec
-
What the properties set for one text style of a theme (font family,
size, weight, line height, letter spacing); whatever is left
nullkeeps Material's value. - SpringThemeData
-
One theme of the app as the
spring.flutter.theme.*properties describe it: colors, typography, shapes, elevations, density, motion, spacing, component adjustments and the app's own tokens. - SpringTypeScale
- The sizes and fonts the 15 text styles of a theme have when the properties set none: the Material 3 type scale, as a table.
-
StateValues<
T> -
A value per widget state, as a property gives it with a map
(
{ default: primary, hovered: secondary, disabled: grey }): the value of the strongest state the widget is in (themeStatePrecedence) that has one, else thedefaultone, elsenull, which makes the component keep Flutter's own value. Internal to the starter. - ThemeConfig
-
The theme properties (
spring.flutter.theme.*) sorted into named themes: the shared part at the root, each theme ofthemes.<name>on top of it (or of the theme itextends), and which theme is active. - ThemeDesign
-
What a design library adds to the themes read from
spring.flutter.theme.*: a palette made from a seed color, the theme properties only its widgets have, and its page transitions. - ThemeDesigns
- The designs the themes of an application are read with: the ThemeDesigns of its starters and the type of its app.
- ThemeProperties
- The resolved properties of one theme, with the helpers that read them: values by path, lists, child keys, parsed values, and the full property name for error messages. Internal to the starter.
- ThemeProperty
- One property a component reads: its key in kebab case, what it holds and whether it takes a value per state.
- ThemeReader
-
Reads the properties of one component (
components.card.*) by Flutter's own property names in camel case (backgroundColorisbackground-colorin 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 aWidgetStateProperty. A component's mapping is its constructor call written with these readers, so adding a property is one line. - ThemeValues
-
Parses the text values of theme properties: colors, weights, numbers,
durations, curves, booleans and enum names. Each parser returns
nullfor a value it cannot read, and the caller reports it as aThemePropertyException. Internal to the starter.
Enums
- PageTransitionType
-
The kinds of
motion.page-transition: how a router's screens come in and go out. - TextScript
- The kinds of writing the type scale has sizes for: Latin-like, dense (Chinese, Japanese, Korean) and tall (Arabic, Hindi, Thai).
Constants
-
colorRoles
→ const List<
String> -
The color roles of a palette that
colors.<role>may set, by canonical name (lower case, no separators): the roles of Material 3. -
defaultSpacing
→ const Map<
String, double> -
The default spacing scale for the app's own widgets, which
spring.flutter.theme.spacingcan change or extend. -
m3Elevations
→ const Map<
String, double> -
The Material 3 elevation levels,
level0tolevel5. -
m3ShapeScale
→ const Map<
String, double> -
The corner radii of the Material 3 shape scale, by canonical token
name;
full(infinite) makes a stadium. -
textStyleNames
→ const List<
String> -
The 15 text styles of Material's
TextTheme, by canonical name (displaylarge...labelsmall). -
themeStateNames
→ const List<
String> -
The states a theme property may give a value for, by canonical name
(
defaultis the value when no other state applies), in the order the documentation lists them. -
themeStatePrecedence
→ const List<
WidgetState> -
Which state wins when a widget is in several at once, strongest
first:
disabled,error,pressed,dragged,hovered,focused,selected,scrolled-under, thendefault.
Functions
-
closestName(
String wrong, Iterable< String> options) → String? -
The closest of
optionstowrong(a typo of at most a third of the name), for a "did you mean" hint;nullwhen none is close. -
didYouMean(
String wrong, Iterable< String> options) → String -
, did you mean 'x'?for the closest ofoptions, else nothing.
Exceptions / Errors
- ThemePropertyException
-
The error thrown when a theme property has a value (or a key) that
cannot be read, such as
seed-color: purpelorseed-colour.