Class Tokens
SizeTokens spacing into the geometry-only containers, which hold
plain floats and therefore cannot follow a size step on their own.
Flex.gap and Padding.insets are literals: a bare
row.setControlSize(SMALL) compacts every child and leaves the gutters between
them at whatever number the app typed, and an app that writes
col.gap(theme.spacingMedium) bakes MEDIUM in permanently. The spacing ramp is the
widest of the three (3.33x), so leaving it unreachable would discard most of the visible
effect of changing step.
Two ways to use this. Prefer TokenRow / TokenColumn / TokenPadding,
which push on every measure pass and therefore track a step change with no app code. Call the
static forms directly only where a container is already owned by something else.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumWhich of the three spacing tokens a container follows. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidapplyGap(Flex flex, Tokens.Role role) Setsflex's gap from the step resolved on it.static voidapplyInsets(Padding padding, Tokens.Role role) Setspadding's insets, uniformly, from the step resolved on it.static floatspacing(SizeTokens tokens, Tokens.Role role) static floatspacingFor(Widget widget, Tokens.Role role) static floattoggleColumnGap(Widget widget) The gap a column ofCheckboxorRadioButtonrows needs so that stacked toggles clear WCAG 2.2 SC 2.5.8's Spacing exception: a toggle row is 18pt at three steps, so the pitchrow + gapmust reach 24.
-
Method Details
-
spacing
- Returns:
- the spacing value for
roleout oftokens
-
spacingFor
- Returns:
- the spacing for
roleat the step resolved onwidget
-
applyGap
Setsflex's gap from the step resolved on it. Idempotent (Flex.gapcarries an equality guard), so calling this from a measure path does not loop. -
applyInsets
Setspadding's insets, uniformly, from the step resolved on it. -
toggleColumnGap
The gap a column ofCheckboxorRadioButtonrows needs so that stacked toggles clear WCAG 2.2 SC 2.5.8's Spacing exception: a toggle row is 18pt at three steps, so the pitchrow + gapmust reach 24.Exposed as a call rather than pushed by a container, because a
TokenColumncannot know its children are toggles. An app stacking toggles applies it explicitly:col.gap(Tokens.toggleColumnGap(col)). Without it, stacked toggles keep a 21/22pt pitch at the dense steps, the same sub-24 admission the toggles themselves carry at MEDIUM today.
-