Contact View Switcher
Component Detail
Description
Toggle control that switches the list between contact view and peer mentor view, notably required for Barnekreftforeningen. Renders as a segmented button or tab bar and communicates the selected view to the parent screen via callback.
contact-view-switcher
Summaries
The Contact View Switcher enables users to seamlessly toggle between the standard contact list and the peer mentor list within a single screen, a capability specifically required for organizations like Barnekreftforeningen that operate both contact and peer mentor networks. This toggle reduces navigation complexity and keeps related people-management workflows within a unified interface, improving operational efficiency for coordinators and administrators. Support for organization-specific label overrides ensures the feature can be adopted by partner organizations with different terminology without requiring custom builds, protecting platform scalability and reducing the cost of onboarding new organizational customers while maintaining a consistent, professional user experience across all deployments.
This low-complexity, dependency-free widget can be completed quickly and in parallel with other components, making it an ideal early delivery to unblock the Contact List Screen integration. Its primary integration point is the contact-list-screen, which consumes the onViewChanged callback to switch rendered content. Acceptance criteria should cover: correct rendering of both view labels, visual active-state indication for the currently selected view, callback emission on toggle, and label override behavior when organization-specific labels are configured. The org labels integration should be tested with at least two label configurations to verify override behavior.
Since the component has no dependencies, testing is straightforward and the component is unlikely to introduce scheduling risk or block other work streams.
ContactViewSwitcher is a stateless Flutter widget parameterized by the current ContactViewType enum value and a ValueChanged
No routing, no Provider access, no BLoC dependenciesāthis is a pure presentational component. Test label override resolution and active-state rendering for both ContactViewType values in widget tests.
Responsibilities
- Render toggle between 'Contacts' and 'Peer Mentors' views
- Emit view change events to parent screen
- Reflect current active view with appropriate visual state
- Support organization-specific label overrides via org labels system
Interfaces
ContactViewSwitcher({required ContactViewType currentView, required ValueChanged<ContactViewType> onViewChanged})
build(BuildContext context)
_getLabel(ContactViewType type, OrgLabels labels)