Technical Documentation: Settings - Theme & UI
Architecture


Theme management is handled by the AppTheme utility class and a global ThemeManager provider that wraps the top-level MaterialApp.
Technical Details
- File Paths:
- lib/config/app_theme.dart (Theme definitions)
- lib/providers/theme_provider.dart (State management)
- Storage: Persists choices locally via SharedPreferences.
State Logic
- Rebuild Lifecycle: Updating themeProvider.currentTheme triggers a global notifying event, causing all widgets to rebuild with new ThemeData without app restarts.
- Color Tokens: Uses a centralized AppTheme object to define semantic colors (e.g., primary, background, accent) across both Light and Dark definitions.
UI Implementation
- Scale Factor: Uses MediaQuery manipulation or custom multipliers on TextStyle and Padding widgets to implement the dynamic UI scaling feature.
- Adaptive Layouts: Uses MediaCondition helpers to detect when a theme switch might require layout adjustments (e.g., changing text contrast levels).