Implement Export Confirmation Dialog with skipped-claims detail
epic-accounting-system-export-ui-task-002 — Build the ExportConfirmationDialog widget that displays the export summary before the coordinator commits. Must show: selected date range, total approved claims count, skipped claims count with reasons (already exported, outside range), and the target exporter name (Xledger or Dynamics). Include a duplicate-export warning state that renders a distinct caution banner when the guard detects an existing export for the same period. Dialog must be fully accessible with semantic labels and focus trapping.
Acceptance Criteria
Technical Requirements
Execution Context
Tier 1 - 540 tasks
Can start after Tier 0 completes
Implementation Notes
Use showModalBottomSheet or showDialog — prefer showDialog for this confirmation use-case to enforce focus trapping via AlertDialog's built-in barrier. Pass the fully-resolved ExportSummary object as a constructor parameter rather than reading from a provider inside the dialog to keep it pure and testable. Map SkipReason enum values to localised strings in a dedicated extension method, not inline in the widget. The duplicate caution banner should use the warning color token from the design token system (not a hardcoded color).
The override checkbox state should be local ephemeral state (StatefulWidget or flutter_hooks) since it does not need to survive navigation. Avoid Navigator.pop() with a return value pattern — instead dispatch a BLoC event (ConfirmExport or CancelExport) from inside the dialog callbacks so the BLoC owns the state transition.
Testing Requirements
Unit tests: verify dialog renders all summary fields from a mock ExportSummary model; verify duplicate warning banner visibility toggled by isDuplicate flag; verify Confirm button disabled state when isDuplicate=true and override unchecked. Widget tests: pump dialog with various ExportSummary configurations (0 skipped, multiple skipped, duplicate flag on/off) and assert rendered text matches inputs. Accessibility tests: use flutter_test semantics tester to verify all Semantics nodes have labels; verify focus order with FocusTrap. Golden tests: render dialog in normal state and duplicate-warning state at 1.0 and 1.5 font scale.
Test coverage target: 90%+ for dialog widget logic.
Export operations may take several seconds, and the UI must handle all intermediate states (loading, partial success, failure, duplicate warning) without leaving the coordinator on a blank or unresponsive screen. Missing state handling causes confusion and potentially double-submissions.
Mitigation & Contingency
Mitigation: Design the BLoC state machine with explicit states for each transition before writing any widget code: ExportIdle, ExportDuplicateWarning, ExportInProgress, ExportSuccess, ExportPartialSuccess, ExportFailed. Each state maps to a distinct UI. Widget tests cover all states.
Contingency: If a loading state is missed in production, surface a generic error state with a retry action rather than leaving the UI stuck. Add a timeout on the Edge Function call (default 30 seconds) that transitions to ExportFailed with a user-readable message.
The custom Export Date Range Picker may not be fully navigable with VoiceOver if the underlying Flutter date widgets do not expose the correct semantic tree. This is a critical accessibility failure for Blindeforbundet users who rely on screen readers.
Mitigation & Contingency
Mitigation: Use Flutter's built-in DateRangePicker as the base and wrap with explicit Semantics nodes for start and end labels. Test with VoiceOver on a physical iOS device as part of the definition of done for this component. Reference the existing AccessibilityTestHarness pattern used elsewhere in the app.
Contingency: If the custom picker fails accessibility audit, replace it with two independent DatePicker fields (start and end) using Flutter's standard accessible date input, which has broader VoiceOver support than range variants.