high priority low complexity frontend pending frontend specialist Tier 3

Acceptance Criteria

Toggling ContactViewSwitcher to 'peer mentors' replaces the ContactCardWidget list with PeerMentorCardWidget instances
Toggling back to 'contacts' restores the ContactCardWidget list
List switching is animated with AnimatedSwitcher or CrossFade — no abrupt snap
The debounced search bar query filters the currently active list (contacts or peer mentors) independently
Scroll position resets to the top when the active view is switched
If the peer mentor list is empty, the empty state from task-009 is shown with an appropriate org-label message
PeerMentorCardWidget receives correctly typed PeerMentor model instances from mock data
Both views share the same search bar widget instance — no duplication
View switch state is held in the BLoC/Riverpod provider, not in local widget state
The active view indicator in ContactViewSwitcher is visually updated to reflect the current selection

Technical Requirements

frameworks
Flutter
BLoC
Riverpod
data models
Contact
PeerMentor
ContactViewType (enum)
performance requirements
AnimatedSwitcher transition must complete within 250ms
Filtering must execute synchronously for mock data sets under 200 items
ui components
ContactViewSwitcher (existing)
PeerMentorCardWidget (from task-005)
ContactCardWidget (existing)
AnimatedSwitcher or AnimatedCrossFade
ScrollController (to reset position on switch)

Execution Context

Execution Tier
Tier 3

Tier 3 - 413 tasks

Can start after Tier 2 completes

Implementation Notes

Introduce a ContactViewType enum (contacts | peerMentors) and add it as a field in the ContactList BLoC/Riverpod state. The filtered list logic should live in the state/notifier, not in the widget build method. Use a single ScrollController exposed via the state or passed down, and call scrollController.jumpTo(0) when the view type changes. Wrap the list with AnimatedSwitcher keyed on the view type to get a smooth crossfade.

Guard PeerMentorCardWidget rendering with a null/empty check on the peer mentor list before delegating to the empty state widget from task-009. Keep mock data consistent with the fixtures established in task-001 to avoid divergence.

Testing Requirements

Widget-test ContactListScreen with mock data for both views: (1) default state shows ContactCardWidget list, (2) toggle to peer mentor view shows PeerMentorCardWidget list, (3) toggle back restores contacts, (4) search query in peer mentor view filters PeerMentorCardWidget items by name, (5) scroll position resets after view switch. Use flutter_test WidgetTester.tap to simulate view switcher toggle. Verify widget types rendered in the list via findsNWidgets and isA(). All tests use mock fixtures.

Component
Contact List Screen
ui medium
Epic Risks (2)
medium impact medium prob technical

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.

low impact medium prob dependency

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.