Build Deduplication Queue Screen
epic-duplicate-activity-detection-state-management-task-009 — Implement the DeduplicationQueueScreen Flutter UI for coordinators to review, compare, and resolve queued duplicate records. Support bulk-dismiss action for NHF group event scenarios. Use DuplicateComparisonPanel for each item, integrate DeduplicationQueueService for data, and display consolidated duplicate summary for bulk registration flows rather than one-at-a-time interruptions.
Acceptance Criteria
Technical Requirements
Execution Context
Tier 2 - 518 tasks
Can start after Tier 1 completes
Implementation Notes
Use a BlocBuilder consuming DeduplicationQueueBLoC state (loading, loaded, error) to drive the screen. The queue list should use AnimatedList (not ListView) so item removals animate smoothly. For real-time updates, the DeduplicationQueueService streams queue changes — have the BLoC subscribe to the stream and emit DeduplicationQueueUpdated events. The 'Select All' visibility threshold of 3+ items reflects NHF's group event use case where bulk registration creates many duplicates simultaneously — below 3, per-item resolution is less disruptive.
Use a SliverList inside a CustomScrollView for the queue to allow a sticky bulk-action bar at the bottom. The BulkDismissConfirmationDialog should be a simple AlertDialog with item count and 'Dismiss N items' / 'Cancel' buttons — no need for a custom bottom sheet. For the expanded DuplicateComparisonPanel, use a single-expansion model: store the expanded item ID in BLoC state, not local widget state, so it survives rebuilds.
Testing Requirements
Widget tests: verify empty state renders when queue is empty. Verify loading skeleton shown during initial fetch. Verify 'Select All' checkbox appears only when 3+ items present. Verify bulk dismiss confirmation dialog shows correct item count.
Verify individual item resolve removes it from AnimatedList. Verify role guard redirects peer mentor users. BLoC integration tests: verify real-time removal when another coordinator resolves an item. Verify bulk dismiss emits correct events and all items are removed on success.
Accessibility tests: verify each queue item tile has correct Semantics label including peer mentor name and conflict type. Golden test: render queue with 3 items at standard and large font sizes.
For bulk registration with many participants, running duplicate checks sequentially before surfacing the consolidated summary could introduce a multi-second delay as each peer mentor is checked individually against the RPC. This degrades the bulk submission UX significantly.
Mitigation & Contingency
Mitigation: Issue all duplicate check RPC calls concurrently using Dart's `Future.wait` or a bounded parallel executor (max 5 concurrent calls to avoid Supabase rate limits). The BLoC collects all results and emits a single BulkDuplicateSummary state with the consolidated list.
Contingency: If concurrent RPC calls hit Supabase connection limits or rate limits, implement a batched sequential approach with a progress indicator showing 'Checking participant N of M' so the coordinator understands the delay is expected and bounded.
In proxy registration, the peer mentor's ID must be used as the duplicate check parameter, not the coordinator's ID. If the proxy context is not correctly threaded through the BLoC and service layer, duplicate checks will silently run against the wrong person, missing actual duplicates.
Mitigation & Contingency
Mitigation: Define a `SubmissionContext` model that carries the effective `peer_mentor_id` (distinct from `submitter_id`) and pass it explicitly through the BLoC event payload. The DuplicateDetectionService always reads peer_mentor_id from SubmissionContext, never from the authenticated user session.
Contingency: If SubmissionContext threading proves difficult to retrofit into the existing proxy registration BLoC, add an assertion in DuplicateDetectionService that throws a descriptive error when peer_mentor_id is null or matches the coordinator's own ID in a proxy context, making the bug immediately visible in testing.