high priority medium complexity frontend pending frontend specialist Tier 4

Acceptance Criteria

multi-chapter-affiliation-chip widget (174) is rendered within EditContactScreen in the chapter affiliation section
On mount, the chip widget is pre-populated with the contact's existing chapter affiliations from form state
User can add a new chapter chip via an add button or dropdown; the new chip appears immediately
User can remove an existing chapter chip via a remove/close icon on each chip
Every add/remove action calls notifier.updateChapterAffiliations(updatedList) to keep form state in sync
If the user removes all chapters, a validation error message is shown (using org-label key 'validation.chapter.required')
Save button is disabled when no chapter is selected (integrated with the isFormValid gate from task-015)
Re-adding a chapter after removing all clears the validation error and re-enables save (if all other fields valid)
All chip interactions are accessible: chips have semantic labels ('Remove [chapter name] affiliation'), add button has a descriptive label
Widget test: removing last chip shows chapter validation error; adding a chip back removes the error

Technical Requirements

frameworks
Flutter
Riverpod
BLoC
apis
Supabase — chapters lookup (GET /rest/v1/chapters) for available chapter options
data models
ChapterAffiliation
ContactEditFormState
Chapter
performance requirements
Chapter list for the add dropdown must be loaded once on screen mount and cached — not re-fetched on each chip interaction
Chip add/remove must update UI synchronously without waiting for network
security requirements
Available chapters list must be filtered by the user's organisation — a user must not be able to assign chapters from other organisations
Chapter IDs sent in ContactEditPayload must be validated against the fetched chapters list before save
ui components
MultiChapterAffiliationChip (174)
ChapterPickerDropdown
FieldErrorText
AppButton (disabled state)

Execution Context

Execution Tier
Tier 4

Tier 4 - 323 tasks

Can start after Tier 3 completes

Implementation Notes

The MultiChapterAffiliationChip widget (174) should accept a list of selected ChapterAffiliation objects and an onChanged callback — treat it as a controlled widget where EditContactScreen owns the state via the form notifier. Load available chapters via a separate chaptersProvider (Riverpod) that queries Supabase once and caches the result for the session. For the add interaction, show a bottom sheet or inline dropdown listing unchosen chapters only (filter out already-selected ones). Validate chapter IDs against the fetched list before constructing ContactEditPayload to prevent injection of arbitrary chapter IDs.

Ensure the 'at least one chapter' validation is wired into the same isFormValid computation as the field validators from task-015 — the save button has a single gate, not multiple independent checks.

Testing Requirements

Widget tests: (1) chip widget renders with pre-populated chapter affiliations from mock form state; (2) tapping remove on a chip calls notifier.updateChapterAffiliations with reduced list; (3) removing last chip shows 'validation.chapter.required' error and disables save; (4) adding a chapter after all removed clears error and enables save (assuming other fields valid); (5) available chapter dropdown shows filtered list from mock Supabase provider. Use ProviderScope overrides for both the contact-detail-service and the chapters repository. Assert Semantics labels on chips for accessibility. No real Supabase calls in tests.

Component
Edit Contact Screen
ui medium
Epic Risks (3)
medium impact medium prob scope

The encrypted-field-display confirmation dialog adds interaction steps that may frustrate coordinators who access sensitive fields frequently, leading to requests to bypass the flow or skip read-receipt logging, which would violate Blindeforbundet's compliance requirements.

Mitigation & Contingency

Mitigation: Design the confirmation dialog to be as minimal as possible (one clear sentence, single confirm action) and ensure it does not reappear for the same field within a single screen session. Validate the UX with Blindeforbundet coordinators during the TestFlight pilot before finalising.

Contingency: If coordinators raise strong objections, escalate to Blindeforbundet's data protection officer to determine whether a lighter confirmation pattern (e.g., biometric confirmation instead of dialog) satisfies their compliance obligation.

medium impact medium prob technical

The activity-history-list infinite scroll requires paginated Supabase queries. Contacts with hundreds of activities (e.g., an HLF peer mentor with 380 annual registrations) could cause slow page loads or memory pressure on older devices if pagination boundaries are set too large.

Mitigation & Contingency

Mitigation: Use a page size of 20 records with cursor-based pagination. Implement list item recycling using Flutter's ListView.builder. Benchmark memory usage with 400+ item simulation on a low-end test device before TestFlight release.

Contingency: If performance degrades on older devices, reduce page size to 10 and add a time-window filter (last 30 days, last 6 months, all) so the default view loads a manageable record count for most coordinators.

low impact high prob scope

The cognitive load rule engine (from the Cognitive Accessibility feature) mandates no more than 7 fields per screen section. If a contact model has more than 7 editable fields, the edit-contact-screen layout must be split into sections, adding complexity not accounted for in the initial scope.

Mitigation & Contingency

Mitigation: Audit the full contact field list from all four organisations before implementation. Group fields into logical sections (personal info, contact details, affiliation) so no single section exceeds 7 fields. Use the cognitive-load-rule-engine component if it is already delivered by the Cognitive Accessibility feature.

Contingency: If the rule-engine component is not yet available, implement a simple manual section layout with accordion-style expansion for less-frequently edited fields to stay within the 7-field guideline without blocking delivery.