FossThemeData class

The root token bundle: the six leaf bundles in one object. Register it once, then read everything through context.fossTheme. FossThemeData.light and FossThemeData.dark are the defaults; build your own to retheme the app.

Customize globally by passing your own FossThemeData, or per instance through the widget's style object. There are no per-instance token props: to change color, radius, or spacing, change the theme.

MaterialApp(
  theme: FossThemeData.light.toThemeData(),
  darkTheme: FossThemeData.dark.toThemeData(),
);
Inheritance
Annotations

Constructors

FossThemeData({required FossColors colors, required FossRadii radii, required FossSpacing spacing, required FossTypography typography, required FossShadows shadows, required FossMotion motion})
Creates a theme from explicit bundles. Prefer the named defaults.
const

Properties

colors FossColors
Semantic color roles.
final
hashCode int
The hash code for this object.
no setteroverride
motion FossMotion
Animation durations.
final
radii FossRadii
Corner radii.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shadows FossShadows
Elevation shadows.
final
spacing FossSpacing
Spacing scale.
final
type Object
The extension's type.
no setterinherited
typography FossTypography
Text styles.
final

Methods

copyWith({FossColors? colors, FossRadii? radii, FossSpacing? spacing, FossTypography? typography, FossShadows? shadows, FossMotion? motion}) FossThemeData
Creates a copy of this theme extension with the given fields replaced by the non-null parameter values.
override
lerp(covariant FossThemeData? other, double t) FossThemeData
Linearly interpolate with another ThemeExtension object.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
retheme(FossThemeSpec spec) FossThemeData
Layers spec over this theme, returning a rethemed copy. Each unset spec field keeps this theme's value; colors pass through enumerated, while radius, spacing, shadow color, and font family seed their scales. Start from light or dark.
toString() String
A string representation of this object.
inherited
toThemeData() ThemeData
This theme wrapped in a ThemeData, to register on MaterialApp.theme. Registers the theme as an extension; it does not restyle Material widgets.

Operators

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

Constants

dark → const FossThemeData
The default dark theme (light, with the dark color set).
light → const FossThemeData
The default light theme.