Files
hash-wallet/lib/themes
c746b85a4b UI updates (#2368)
* Add Black theme

* Fix black theme

* Add WixMadefor Font

* feat: Enhance theme setup

This change:
- Adds support for custom themes
- Updates theme retrieval logic to ensure the right theme is used based on user preferences(especially for custom themes).

* Add black custom colors

* Add custom accent colors

* feat: Restructure custom colors handling for themes

* feat: Integrate new custom colors structure across various components - WIP

* feat: Integrate new custom colors structure across various components, black theme now ready for tests

* feat: Add new accent color themes and update theme selection UI

- Enhanced theme selection UI in display settings to support accent color choices.
- Updated theme handling logic to accommodate new accent color variants.

* Minor updates to display_settings_page.dart

* Update settings_theme_choice.dart

* Revert accidental change in display_settings_page.dart

* Revert WixMadeFor font, fix SVG colors for CakeImageWidget, and test some color changes

* Update Monero Orange

* fix: Remove unused custom colors

* Test outline

* Test spacing and colors

* Add padding

* Remove outline

* Add other accent colors

* Update display_settings_view_model.dart

* Update names and fix switch case

* Add outline and update dark_theme.dart colors

* Add gradient to option_tile.dart

* Update icons

* Update some colors

* Switch option_tile.dart to TextButton

* Add updated icons

* Fix icon resolution

* Cleanup old icons + Update pubspec_base.yaml

* Remove unused fonts

* Update more icons

* Update image paths

* Remove more icons + update some component colors

* Add back DAI icon

* Fix errors

* feat: Implement OLED mode for BlackTheme

* feat: Add OLED mode for BlackTheme and localizations

* feat: Implement OLED mode for Black Theme

* refactor: Remove unused theme parameters and set up easy access to toggleKnob custom colors

* fix: Cleanup UI and overflows

* feat: Persist black theme selection if OS theme mode while app is in system mode

* fix: OS theme change when app is in background restrict pin screen from proceed

* Fix theme picker sizing

* Update lib/src/screens/dashboard/desktop_widgets/desktop_wallet_selection_dropdown.dart

Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>

* refactor: Enhance theme access by introducing ThemeX extension for easier retrieval of current theme and custom colors

* refactor: Remove currentTheme parameter from GradientBackground widget and adjust across affected widgets

* refactor: Remove currentTheme parameter from StandardSwitch and SettingsSwitcherCell, using ThemeX extension for theme access

* refactor: Remove currentTheme parameter from various widgets dependent on SettingsSwitcherCell and StandardxSwitcher, using ThemeX extension for theme access

* refactor: Remove currentTheme in bottomsheets and related widgets, switching to theme extension

* refactor: Remove constructor theme access in OptionTile and related widgets, switching to theme extension

* refactor: Switch bottomsheet related widgets to use theme extension instead of constructor access

* refactor: Migrate currentTheme access from constructor based to extension base

* refactor: Switch theme access from constructor base to extension base [skip ci]

* refactor: Migrate more widgets to use extension based theme access and clean up code

* refactor: Update theme access across multiple widgets to use the new theme extension

* refactor: Clean up theme access in various widgets, moving to extension-based theme usage

* refactor: Make theme picker preview responsive

* fix: Persist saved black theme accent when app is put in background and brought back

* remove unused variables [skip ci]

---------

Co-authored-by: Blazebrain <davidadegoke16@gmail.com>
Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
2025-10-10 16:00:39 +03:00
..
2025-10-10 16:00:39 +03:00
2025-10-10 16:00:39 +03:00
2025-10-10 16:00:39 +03:00
2025-10-10 16:00:39 +03:00
2025-05-25 23:11:45 +03:00

Material 3 Theming System

This directory contains the Material 3 (M3) theming implementation for Cake Wallet. The theming system is now fully based on Material 3 color tokens and patterns, with all custom theme extensions removed for simplicity, maintainability, and compliance with Material Design 3 guidelines.

Directory Structure

lib/themes/
├── core/                # Theme state management and base theme logic
├── theme_classes/       # Light and dark theme data definitions
├── extensions/          # (Optional) Theme extensions for specific widgets/pages
├── utils/               # Utilities for theme management
└── README.md            # This file

Key Features

  • Material 3 color system with semantic color tokens
  • Dynamic color support (when available)
  • MobX-based state management
  • Simplified theme management
  • Consistent design language across the app

Usage

Accessing Theme Colors

final colorScheme = Theme.of(context).colorScheme;
final primaryColor = colorScheme.primary;
final onSurfaceVariant = colorScheme.onSurfaceVariant;

Available Color Tokens

Material 3 provides a comprehensive set of semantic color tokens that adapt to light/dark themes:

  • primary / onPrimary
  • secondary / onSecondary
  • tertiary / onTertiary
  • error / onError
  • background / onBackground
  • surface / onSurface
  • surfaceVariant / onSurfaceVariant
  • outline, outlineVariant
  • ...and more (see Flutter's ColorScheme)

Theme Management

Theme mode state (light/dark/system) and switching is handled via MobX stores in core/. Use the provided store to get/set the current theme mode and listen for changes.

// Example: Getting the current theme mode
final themeStore = ... // Obtain from provider or context
final isDark = themeStore.isDark;

// Example: Switching theme mode
await themeStore.setThemeMode(ThemeMode.dark);

Best Practices

  1. Always use semantic color tokens from ColorScheme instead of hardcoded colors.
  2. Leverage Material 3 components wherever possible for consistency and accessibility.
  3. Use the MobX theme store for all theme-related state and switching.
  4. Test in both light and dark modes to ensure good contrast and appearance.
  5. Keep any theme extensions minimal and focused (if used at all).
  6. Do not reintroduce custom theme extensions unless absolutely necessary and not covered by Material 3.

Adding or Modifying Themes

  • To update theme colors, edit the files in theme_classes/ (e.g., light_theme.dart, dark_theme.dart).
  • To add a new theme variant, create a new file in theme_classes/ and update the MobX store in core/ to support it.
  • For widget-specific theming, prefer using Material 3's built-in tokens. Only use a theme extension if there is no Material 3 equivalent.

Contributing

  • Follow Material 3 color system and accessibility guidelines.
  • Ensure proper contrast ratios for accessibility.
  • Test all changes in both light and dark modes.
  • Update this documentation if you add new color tokens or theme variants.
  • Keep theme files organized and focused.