Define Semantic Color Tokens for Design Token Theme
epic-peer-mentor-detail-screen-foundation-task-002 — Define the semantic color token set as a Flutter ThemeExtension subclass. Include tokens for certification status states (active, expiring_soon, expired, paused), surface backgrounds, text hierarchy levels, and interactive element colors. Provide both light and dark mode variants for every token. Semantic names must abstract away raw hex values so all downstream widgets reference meaning, not specific colors.
Acceptance Criteria
Technical Requirements
Implementation Notes
Extend `ThemeExtension
Document the hex values and their WCAG contrast ratios in a inline comment block for future designers. This class must have zero Flutter widget dependencies so it can be unit-tested without `pumpWidget`.
Testing Requirements
Write widget tests using `flutter_test`. Test 1: `AppColorTokens.light` and `AppColorTokens.dark` are non-null and have distinct values for at least one token (e.g., `surfacePrimary`). Test 2: `lerp` between light and dark at `t=0.5` produces intermediate values without throwing. Test 3: `copyWith` correctly overrides a single field while preserving all others.
Optionally, a contrast-ratio helper test asserting that each status foreground/background pair meets WCAG AA 4.5:1.
The design token theme extension may conflict with existing ThemeData extensions already registered in the app, causing runtime assertion errors or token resolution failures across all screens that consume the tokens.
Mitigation & Contingency
Mitigation: Audit all existing ThemeData extensions before implementation. Use a unique extension key namespace and add integration tests that instantiate the combined theme in a test app harness.
Contingency: If conflicts arise, isolate design tokens behind a dedicated provider singleton (Riverpod) rather than a ThemeData extension, updating all consuming widgets to read from the provider instead.
The 30-day warning threshold for expiring_soon status may differ between HLF's stated requirement in workshops (60 days mentioned in user stories) and the 30-day value in component documentation, causing disagreement during acceptance testing.
Mitigation & Contingency
Mitigation: Explicitly confirm the threshold value with HLF stakeholder before implementation. Make the threshold a named constant (kCertificationWarnDays) so it can be updated without logic changes.
Contingency: If stakeholder confirms 60 days post-implementation, update the constant and re-run the unit test suite — no architectural change required.