Add accessible semantics to CertificationStatusBadge
epic-peer-mentor-detail-screen-ui-components-task-004 — Wrap CertificationStatusBadge in Flutter Semantics with a human-readable label computed from the expiry state (e.g., 'Certification valid until 12 March 2026', 'Certification expired 3 days ago'). Ensure VoiceOver and TalkBack announce the label when the widget receives focus. Verify WCAG 2.2 AA contrast ratios for all three visual states against the design token palette.
Acceptance Criteria
Technical Requirements
Execution Context
Tier 1 - 540 tasks
Can start after Tier 0 completes
Implementation Notes
Add a private `_buildSemanticsLabel(CertificationStatus status, DateTime expiry, DateTime now)` function that returns the human-readable string. Use `DateFormat.yMMMMd('en')` for consistent English date formatting — do not use `.toString()` on DateTime. For WCAG contrast verification, use a contrast checker tool (e.g., WebAIM or a Flutter contrast plugin) against the design token hex values. Document the contrast ratios in a comment block above the token definitions: `// active badge: #XXXXXX on #XXXXXX = 5.2:1 (AA pass)`.
The accessibility requirement is especially critical given the project's target user base — blind and hearing-impaired users per the Blindeforbundet and HLF workshop requirements.
Testing Requirements
Widget tests: (1) `tester.getSemantics(find.byType(CertificationStatusBadge))` returns a SemanticsNode with a non-empty label for each of the three states, (2) expired semantics label contains 'expired', (3) active semantics label contains the formatted date string, (4) expiring_soon label contains 'days'. Also write a static analysis test or linter rule to assert that no `Container` with a background color inside the badge uses a color with contrast ratio below 4.5:1 against its foreground text color — this can be a documented manual verification step if automated contrast tooling is not available in the project.
The org labels system may not yet have label keys defined for peer mentor detail screen terminology (role labels, section headings), requiring additions to the label key registry that must be coordinated with the admin configuration team.
Mitigation & Contingency
Mitigation: Audit existing label keys in the terminology system before starting OrgLabelsProvider integration. Submit required new label keys for admin configuration in parallel with component implementation.
Contingency: If label keys are not available at integration time, use hardcoded English fallbacks with a clear TODO for admin configuration, ensuring the widget renders correctly while keys are being provisioned.
The design token semantic colors (warning, error surface) may not meet WCAG 2.2 AA 4.5:1 contrast ratio when rendered on the app's background surface tokens, requiring design system changes that affect the entire app.
Mitigation & Contingency
Mitigation: Run contrast ratio validation on the token palette during Epic 1 design token implementation. Flag any failing pairs to the design system owner before building UI components that depend on them.
Contingency: If tokens fail contrast requirements, define supplementary high-contrast override tokens specific to alert and badge contexts that meet AA without modifying the global palette.