Implement PeerMentorCardWidget with mentor-specific data fields
epic-contact-list-management-ui-components-task-004 — Build PeerMentorCardWidget as a visually distinct Flutter widget from ContactCardWidget. Display mentor name, availability status (active/paused/unavailable) as a colored chip, certification status (current/expiring/expired) as a badge, and assigned member count as a numeric indicator. Use a distinct card background color and layout from ContactCardWidget to allow users to instantly differentiate the two types in a mixed list.
Acceptance Criteria
Technical Requirements
Execution Context
Tier 1 - 540 tasks
Can start after Tier 0 completes
Implementation Notes
Define an enum or sealed class for AvailabilityStatus (active, paused, unavailable) and CertificationStatus (current, expiring, expired) if not already present in the domain layer. Map each enum value to a design token color inside a helper method or extension, keeping color logic out of the widget's build method. For the certification 'expiring' state, compute whether a given expiry DateTime falls within 30 days of DateTime.now() in the data layer or a ViewModel — the widget itself should only receive the enum, not raw dates. Use a left-side colored border (Container with BoxDecoration borderRadius + border) or a subtly different card surface token to differentiate from ContactCardWidget without making the UI feel inconsistent.
Follow the same structural layout conventions as ContactCardWidget (padding, typography scale) to ensure visual coherence while still being distinguishable at a glance.
Testing Requirements
Write flutter_test widget tests covering: (1) rendering each availability status (active, paused, unavailable) and asserting the correct chip label and color token is applied; (2) rendering each certification status (current, expiring, expired) and asserting badge label and color; (3) zero assigned members shows '0 members' text without errors; (4) onTap callback fires when card is tapped; (5) visual distinction from ContactCardWidget — assert that the background color/decoration of PeerMentorCardWidget differs from ContactCardWidget when both are rendered in the same test tree. Use fixture data from task-001 mock data. No e2e tests required.
Design token color values used in role badges, certification status indicators, and availability chips may not meet the WCAG 2.2 AA contrast ratio of 4.5:1 when rendered against card backgrounds, requiring rework after accessibility review and potentially blocking acceptance sign-off.
Mitigation & Contingency
Mitigation: Run the contrast-ratio-validator on every new token combination during widget development. Enforce the CI accessibility lint runner on all PRs touching visualization components, and validate against the contrast-safe-color-palette before finalizing card designs.
Contingency: If contrast failures are found late, adjust token values in the design token theme centrally — since all widgets consume design tokens rather than hardcoded colors, all affected widgets will be corrected by a single token update without per-widget changes.
The ContactViewSwitcher is required for Barnekreftforeningen but must not appear for other organizations. If the organization labels provider does not yet expose a reliable feature flag for this widget, it may render universally or be conditionally hidden in an inconsistent way, breaking the role-specific layout contract.
Mitigation & Contingency
Mitigation: Implement view switcher visibility as a constructor parameter on ContactListScreen injected from a provider, defaulting to hidden. Document the integration point for the org labels provider so the flag can be wired without changing the widget's API.
Contingency: If org labels integration is delayed beyond this epic, use a feature flag constant keyed to the Barnekreftforeningen organization ID as a temporary gate, with a tracked issue to replace it with the runtime labels provider before general release.