AstryxTypeRole enum

A semantic typography role — one row of the type scale.

The 42 type-scale tokens are fourteen roles × three properties (size, weight and leading). This enum names the roles and derives the three token names from each, so callers ask for a role rather than assembling --text-heading-1-size by hand.

The mapping from role to font family follows upstream's generateTypeScaleComponents: headings and display sizes use the heading family, code uses the code family, everything else uses the body family.

{@tool snippet}

final style = theme.textStyle(AstryxTypeRole.body);

{@end-tool}

Inheritance
Available extensions

Values

heading1 → const AstryxTypeRole

The largest heading.

const AstryxTypeRole('heading-1', AstryxTypographyToken.heading)
heading2 → const AstryxTypeRole

A section heading.

const AstryxTypeRole('heading-2', AstryxTypographyToken.heading)
heading3 → const AstryxTypeRole

A subsection heading.

const AstryxTypeRole('heading-3', AstryxTypographyToken.heading)
heading4 → const AstryxTypeRole

A heading at the base size — the type scale's anchor.

const AstryxTypeRole('heading-4', AstryxTypographyToken.heading)
heading5 → const AstryxTypeRole

A small heading.

const AstryxTypeRole('heading-5', AstryxTypographyToken.heading)
heading6 → const AstryxTypeRole

The smallest heading.

const AstryxTypeRole('heading-6', AstryxTypographyToken.heading)
body → const AstryxTypeRole

Default body copy.

const AstryxTypeRole('body', AstryxTypographyToken.body)
large → const AstryxTypeRole

Body copy one step up, for emphasis.

const AstryxTypeRole('large', AstryxTypographyToken.body)
label → const AstryxTypeRole

Form and control labels.

const AstryxTypeRole('label', AstryxTypographyToken.body)
code → const AstryxTypeRole

Inline and block code.

const AstryxTypeRole('code', AstryxTypographyToken.code)
supporting → const AstryxTypeRole

Secondary copy — hints, captions, helper text.

const AstryxTypeRole('supporting', AstryxTypographyToken.body)
display1 → const AstryxTypeRole

The largest display size, above every heading.

const AstryxTypeRole('display-1', AstryxTypographyToken.heading)
display2 → const AstryxTypeRole

The middle display size.

const AstryxTypeRole('display-2', AstryxTypographyToken.heading)
display3 → const AstryxTypeRole

The smallest display size, nearest heading1.

const AstryxTypeRole('display-3', AstryxTypographyToken.heading)

Properties

cssSegment String
The role's segment of its token names, such as heading-1 or body.
final
familyToken AstryxTypographyToken
The typography token naming this role's font family.
final
hashCode int
The hash code for this object.
no setterinherited
headingLevel int?
The heading level this role represents, or null if it is not a heading.
no setter
index int
A numeric identifier for the enumerated value.
no setterinherited
leadingName String
The CSS custom property holding this role's line-height ratio.
no setter
name String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sizeName String
The CSS custom property holding this role's font size.
no setter
weightName String
The CSS custom property holding this role's font weight.
no setter

Methods

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

heading(int level) AstryxTypeRole
The role for heading level, 1 through 6.

Constants

values → const List<AstryxTypeRole>
A constant List of the values in this enum, in order of their declaration.