PrismTokens class
The shared design tokens every Prism component reads from.
Prism components ship with sensible defaults, so you never have to install tokens. Register them once and every Prism widget on screen — toasts, banners, sheets, skeletons, tables — picks up the same spacing rhythm, corner radii and motion language.
MaterialApp(
theme: ThemeData(
extensions: const [PrismTokens.fallback], // or your own values
),
)
Read them anywhere with PrismTokens.of or the context.prismTokens
extension:
final tokens = context.prismTokens;
SizedBox(height: tokens.spaceMd);
- Inheritance
-
- Object
- ThemeExtension<
PrismTokens> - PrismTokens
- Available extensions
- Annotations
Constructors
- PrismTokens({double spaceXs = 4, double spaceSm = 8, double spaceMd = 16, double spaceLg = 24, double spaceXl = 32, double spaceXxl = 48, double radiusSm = 8, double radiusMd = 12, double radiusLg = 16, double radiusXl = 24, Duration durationFast = const Duration(milliseconds: 120), Duration durationMedium = const Duration(milliseconds: 240), Duration durationSlow = const Duration(milliseconds: 420), Curve curveStandard = Curves.easeInOutCubic, Curve curveEmphasized = Curves.easeOutExpo, Curve curveExit = Curves.easeInCubic, double contentMaxWidth = 720, double breakpointCompact = 600, double breakpointExpanded = 840, double controlHeight = 44, double borderWidth = 1})
-
Creates a token set. Every field has a sensible default so you can
override only what you care about.
const
Properties
- borderWidth → double
-
Hairline border width used for dividers and outlined surfaces.
final
- breakpointCompact → double
-
Window width below which the layout is considered "compact" (phone).
final
- breakpointExpanded → double
-
Window width at or above which the layout is considered "expanded".
final
- contentMaxWidth → double
-
Maximum content width on wide windows before content centres.
final
- controlHeight → double
-
Standard height for buttons, fields and list rows.
final
- curveEmphasized → Curve
-
Emphasized easing for entrances.
final
- curveExit → Curve
-
Easing used when something leaves the screen.
final
- curveStandard → Curve
-
Standard easing for symmetric transitions.
final
- durationFast → Duration
-
Fast motion — 120 ms by default. Hover, press, tiny fades.
final
- durationMedium → Duration
-
Medium motion — 240 ms by default. Enter/exit, reveals.
final
- durationSlow → Duration
-
Slow motion — 420 ms by default. Page transitions, large layout shifts.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- radiusLg → double
-
Large corner radius — 16 by default.
final
- radiusMd → double
-
Medium corner radius — 12 by default.
final
- radiusSm → double
-
Small corner radius — 8 by default.
final
- radiusXl → double
-
Extra-large corner radius — 24 by default.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- spaceLg → double
-
Large spacing — 24 by default.
final
- spaceMd → double
-
Medium spacing — 16 by default.
final
- spaceSm → double
-
Small spacing — 8 by default.
final
- spaceXl → double
-
Extra-large spacing — 32 by default.
final
- spaceXs → double
-
Extra-small spacing — 4 logical pixels by default.
final
- spaceXxl → double
-
Extra-extra-large spacing — 48 by default.
final
- type → Object
-
The extension's type.
no setterinherited
Methods
-
copyWith(
{double? spaceXs, double? spaceSm, double? spaceMd, double? spaceLg, double? spaceXl, double? spaceXxl, double? radiusSm, double? radiusMd, double? radiusLg, double? radiusXl, Duration? durationFast, Duration? durationMedium, Duration? durationSlow, Curve? curveStandard, Curve? curveEmphasized, Curve? curveExit, double? contentMaxWidth, double? breakpointCompact, double? breakpointExpanded, double? controlHeight, double? borderWidth}) → PrismTokens -
Creates a copy of this theme extension with the given fields
replaced by the non-null parameter values.
override
-
lerp(
covariant ThemeExtension< PrismTokens> ? other, double t) → PrismTokens -
Linearly interpolate with another ThemeExtension object.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
of(
BuildContext context) → PrismTokens - Reads the nearest tokens, falling back to PrismTokens.fallback.
Constants
- fallback → const PrismTokens
- The Prism default token set: a 4-point spacing scale, 8/12/16/24 radii, and a fast/medium/slow motion language.