Document theme builder integration guide
epic-visual-design-accessibility-theme-integration-task-010 — Write the developer integration guide for the AccessibleThemeBuilder covering: how to add a new organisation's branding config, the override validation flow and error handling contract, the Riverpod provider graph showing theme builder dependencies, and a troubleshooting section for common debug-mode assertion failures. Include code samples demonstrating correct MaterialApp wiring and organisation context switching.
Acceptance Criteria
Technical Requirements
Execution Context
Tier 9 - 22 tasks
Can start after Tier 8 completes
Handles integration between different epics or system components. Requires coordination across multiple development streams.
Implementation Notes
Write the guide as a Markdown file co-located with the theme builder source (e.g., `lib/src/theme/README.md`) or in a top-level `docs/` directory depending on project convention — check existing documentation placement before deciding. Use Mermaid for the provider dependency graph if the project's documentation renderer supports it (GitHub renders Mermaid natively); otherwise use ASCII art. Structure the document with the most common task first ('Add a new organisation') so developers find the answer immediately without reading the full guide. Keep code samples minimal — show only what is needed to illustrate the point and use `// ...
existing code` comments to elide boilerplate. For the troubleshooting section, write each entry as: **Symptom** (exact console output or visible behaviour) → **Root cause** (one sentence) → **Fix** (numbered steps). Include a 'Quick reference' table at the top mapping provider names to their purpose — this serves as a fast lookup for developers who already know the system. Cross-reference the test file written in task-009 so developers know where to find examples of correct usage in a test context.
Testing Requirements
Documentation testing: extract all Dart code samples from the guide and run them through `dart analyze` to confirm zero analysis errors. Run `dart format --output=none --set-exit-if-changed` on code samples to confirm they follow project formatting conventions. Manual review test: a developer not involved in the ThemeBuilder implementation should attempt to follow the 'add a new organisation' steps on a branch and report any steps that were unclear or missing. Any gaps found during review must be addressed before the guide is merged.
Verify the Riverpod provider graph is accurate by comparing it to the actual provider definitions in the source files — outdated graphs are worse than no graph.
One or more of the four partner organisations may supply brand primary colors that cannot be paired with any standard foreground at 4.5:1 contrast (for example, a mid-range hue that is too light for dark text and too dark for white text). Rejecting these colors programmatically could cause a political dispute with the organisation and delay the feature.
Mitigation & Contingency
Mitigation: Before implementation begins, run all four organisations' existing brand primary colors through the contrast-ratio-validator against both white (#FFFFFF) and a near-black (#1A1A1A). Share the results with each organisation's contact person ahead of the theme builder sprint so any problematic colors can be adjusted collaboratively with advance notice.
Contingency: If an organisation insists on a non-compliant brand color, produce a compliant near-match (lightened or darkened along the hue's luminance axis) and present both options with contrast ratio evidence. Document the adjusted token in the manifest with an explicit note that the original brand color was non-compliant, and obtain written sign-off from the organisation.
Flutter's ThemeData contains over 30 component theme properties. If the theme-builder only addresses the most common ones (Button, InputDecoration, Card) and leaves others at Flutter defaults, downstream feature teams may unknowingly use default-themed widgets that do not meet sizing or contrast requirements.
Mitigation & Contingency
Mitigation: Produce a full inventory of all ThemeData component theme properties and map each to either a token-driven override or an explicit pass-through decision documented in the theme builder code. Prioritise the inventory by frequency of use in the existing codebase (identified via Grep). Include a check in the CI lint runner that flags widgets using Flutter default component themes not covered by the theme builder.
Contingency: If the full inventory scope exceeds the sprint budget, ship with the highest-frequency components covered and add a tracked backlog item for each uncovered component theme, pairing with a temporary lint suppression comment that includes the backlog reference.