Naming prefixes
The variant pattern
Components encode variants as a private enum + named constructors, never a publicvariant parameter:
elevation exists only on the elevated StyledCard), and call sites read naturally. StyledListTile takes it further: variant-only, no default constructor.
Token discipline
- Never hardcode colors or text styles — everything comes from
context.colorTheme/context.textTheme. - Semantic over primitive —
colors.surfaceBg, notSundialRef.sandLight[1]. Direct primitive use is reserved for deliberate cases (wallpaper palettes, the solid-wallpaper dark-text rule). - Accent for persona branding — persona-responsive UI reads
colors.accent.*; never a specific palette’s colors. - Test both brightness modes — tokens make it work; you still verify contrast.
Component reuse
Before building a custom widget:grep -r "StyledTextField" lib/.
State management in components
Design-system components areStatelessWidget wherever possible. Only StyledTabBar uses hooks (HookWidget) — and only to bridge a TabController. No Riverpod inside lib/design_system/ — providers belong to app-level widgets.
Accessibility
- Composite tappables get
SemanticButton— one semantics node,button: true. - Icons are decorative by default (
semanticLabel: nullonAshIcon); label at the button layer. - Nav taps give haptic feedback (
HapticFeedback.selectionClick()inNavDestination).
Wallpaper legibility
Solid wallpaper → dark sand-12 ink (contentOnBrand), no scrim. Textured wallpaper → ThemeOverride(brightness: dark) + gradient scrim. Canonical implementation: StyledListTile.
Modern Flutter idioms
The codebase tracks recent Flutter/Dart features — patterns you’ll see inside components:Column(spacing: 8)/Row(spacing: 12)instead ofSizedBoxseparatorsswitchexpressions for variant dispatch- Null-aware collection elements (
?childinside children lists) - Dot-shorthands for enum/static access (e.g.
mainAxisSize: .min) Color.withValues(alpha: …)instead of deprecatedwithOpacity
pubspec.yaml’s Flutter constraint before assuming an API’s availability.