Theme Provider Service
Component Detail
Service Layer
medium complexity
mobile
0
Dependencies
0
Dependents
2
Entities
0
Integrations
Description
A Riverpod-based provider that manages the active theme state (default vs. high-contrast) and injects the resolved MaterialApp ThemeData at the root of the widget tree. It exposes a reactive theme stream so any widget in the tree can respond to runtime theme switches. The high-contrast override replaces only color tokens while inheriting all other design decisions.
theme-provider-service
Responsibilities
- Expose current ThemeMode (default or high-contrast) as a Riverpod StateProvider
- Build and cache resolved ThemeData from design tokens on theme change
- Persist the user's theme preference via accessibility preferences repository
- Provide a theme toggle method callable from Settings and Accessibility screens
Interfaces
themeModeProvider (StateProvider<ThemeMode>)
resolvedThemeProvider (Provider<ThemeData>)
toggleHighContrast()
setThemeMode(ThemeMode mode)
getCurrentThemeMode() -> ThemeMode
watchThemeChanges() -> Stream<ThemeMode>
buildThemeData(tokens: DesignTokens) -> ThemeData
buildHighContrastOverride(base: ThemeData) -> ThemeData
Related Data Entities (2)
Data entities managed by this component