Build OnboardingProgressIndicator adaptive step-dot widget
epic-organization-selection-and-onboarding-foundation-task-012 — Implement the OnboardingProgressIndicator widget that renders a row of labeled step dots adapting to the active auth phase: email/password flow (3 steps: Organization → Credentials → Verify) vs. BankID/Vipps flow (3 steps: Organization → BankID/Vipps → Complete). Accept a currentStep integer and authPhase enum as parameters. Apply design-token styling, animate transitions between steps, and expose semantic progress announcements for screen readers (e.g., 'Step 2 of 3: Credentials').
Acceptance Criteria
Technical Requirements
Implementation Notes
Define AuthPhase as an enum in a shared types file (lib/core/enums/auth_phase.dart). Define a StepConfig model: { label: String, semanticLabel: String }. Map AuthPhase to List
Connector lines between dots: thin horizontal Divider or Expanded(child: Container(height: 1)). Semantics block: wrap entire Row with Semantics(label: 'Step $currentStep of $totalSteps: $activeLabel', liveRegion: true) — liveRegion: true ensures screen readers announce changes without user interaction. Source all sizes from AppSpacing tokens and colors from AppColors tokens.
Testing Requirements
Widget tests using flutter_test. Test each AuthPhase variant produces correct label set. Test currentStep=1, currentStep=2, currentStep=3 produce correct active/completed/inactive dot states. Test semantic string output via SemanticsHandle for each step transition.
Test animation completion: pump widget, change currentStep, pumpAndSettle(), assert final state. Test narrow screen (320dp) via tester.binding.window.physicalSizeTestValue. Coverage target: 100% of public API.
iOS Keychain and Android Keystore have meaningfully different failure modes and permission models. The secure storage plugin may throw platform-specific exceptions (e.g., biometric enrollment required, Keystore wipe after device re-enrolment) that crash higher-level flows if not caught at the adapter boundary.
Mitigation & Contingency
Mitigation: Wrap all storage plugin calls in try/catch at the adapter layer and expose a typed StorageResult<T> instead of throwing. Write integration tests on real device simulators for both platforms in CI using Fastlane. Document the exception matrix during spike.
Contingency: If a platform-specific failure cannot be handled gracefully, fall back to in-memory-only storage for the current session and surface a non-blocking warning to the user; log the event for investigation.
Setting a session-level Postgres variable (app.current_org_id) via a Supabase RPC requires that RLS policies on every table reference this variable. If the Supabase project schema has not yet defined these policies, the configurator will set the variable but queries will return unfiltered data, giving a false sense of security.
Mitigation & Contingency
Mitigation: Include a smoke-test RPC in the SupabaseRLSTenantConfigurator that verifies the variable is readable from a policy-scoped query before marking setup as complete. Coordinate with the database migration task to ensure RLS policies reference app.current_org_id before the configurator is shipped.
Contingency: If RLS policies are not in place at integration time, gate all data-fetching components behind a runtime check in SupabaseRLSTenantConfigurator.isRlsScopeVerified(); block data access and surface a developer warning until policies are confirmed.
Fetching feature flags from Supabase on every cold start adds network latency before the first branded screen renders. On slow connections this may cause a perceptible blank-screen gap or cause the app to render with default (unflagged) state before flags arrive.
Mitigation & Contingency
Mitigation: Persist the last-known flag set to disk in the FeatureFlagProvider and serve stale-while-revalidate on startup. Gate flag refresh behind a configurable TTL (default 15 minutes) so network calls are not made on every launch.
Contingency: If stale flags cause a feature to appear that should be hidden, add a post-load re-evaluation pass that reconciles the live flag set with the rendered widget tree and triggers a targeted rebuild where needed.