|
2 | 2 | title: 'Guide: Styling & Theming'
|
3 | 3 | description: Learn how to customize the application's visual appearance.
|
4 | 4 | ---
|
5 |
| -import { Card, CardGrid, Aside } from '@astrojs/starlight/components'; |
| 5 | +import { Aside } from '@astrojs/starlight/components'; |
6 | 6 |
|
7 |
| -The mobile client's visual appearance is managed by a centralized theming system located in the `ui_kit` package. This allows for consistent styling and easy customization of the app's look and feel. The system is built on top of the powerful `flex_color_scheme` package. |
| 7 | +The visual appearance of the Mobile Client—including colors, fonts, and spacing—is managed centrally to ensure consistency with the Web Dashboard. This is achieved through a shared `ui_kit` package. |
8 | 8 |
|
9 |
| -### Core Theming Files |
| 9 | +Because this is a cross-application concern, the primary, hands-on guide for making theme customizations is located in our new **Architecture & Customization** section. This central guide walks you through the entire process, from taking ownership of the `ui_kit` package to seeing your changes reflected in both the mobile and web apps. |
10 | 10 |
|
11 |
| -All theme-related logic is located in `packages/ui-kit/lib/src/theme/app_theme.dart`. This file contains: |
| 11 | +<Aside type="tip" title="Start Here for Customization"> |
| 12 | +To learn how to properly customize the UI, please follow our comprehensive, step-by-step tutorial: |
12 | 13 |
|
13 |
| -- **`lightTheme()` and `darkTheme()`**: These functions generate the `ThemeData` for the light and dark modes of the application. |
14 |
| -- **`_commonSubThemesData`**: A constant that defines shared customizations for common widgets like `Card`, `AppBar`, and `InputDecorator`. |
15 |
| -- **`_customizeTextTheme()`**: A helper function that applies user-selected font sizes and weights to the base `TextTheme`. |
16 |
| -- **`_getGoogleFontTextTheme()`**: A helper that maps a font family name (e.g., "Roboto") to the corresponding text theme function from the `google_fonts` package. |
17 |
| - |
18 |
| -### How to Customize the Theme |
19 |
| - |
20 |
| -#### 1. Changing Colors |
21 |
| - |
22 |
| -The application uses predefined color schemes from `FlexColorScheme`. You can change the active color scheme by modifying the `AppAccentTheme` enum in `packages/core/lib/src/enums/app_enums.dart` and updating the `_mapAppAccentTheme` helper in `lib/app/bloc/app_bloc.dart`. |
23 |
| - |
24 |
| -To add a completely new custom color scheme: |
25 |
| -1. Define your custom `FlexSchemeData` in `app_theme.dart`. |
26 |
| -2. Add a new value to the `AppAccentTheme` enum. |
27 |
| -3. Update the `_mapAppAccentTheme` helper in `AppBloc` to map your new enum value to your custom scheme. |
28 |
| - |
29 |
| -#### 2. Customizing Widget Styles |
30 |
| - |
31 |
| -You can change the default appearance of common widgets by modifying the `_commonSubThemesData` constant in `app_theme.dart`. |
32 |
| - |
33 |
| -For example, to change the default elevation of all cards in the app: |
34 |
| - |
35 |
| -```dart title="packages/ui-kit/lib/src/theme/app_theme.dart" |
36 |
| -const FlexSubThemesData _commonSubThemesData = FlexSubThemesData( |
37 |
| - // ... |
38 |
| - cardElevation: 4.0, |
39 |
| - // ... |
40 |
| -); |
41 |
| -``` |
42 |
| - |
43 |
| -#### 3. Adding a New Font |
44 |
| - |
45 |
| -To make a new font available for users to select: |
46 |
| -1. Add the font to your project assets and declare it in `pubspec.yaml`. |
47 |
| -2. Add the new font name to the list of available fonts in `lib/settings/view/font_settings_page.dart`. |
48 |
| -3. Update the `_getGoogleFontTextTheme` helper in `app_theme.dart` to map the new font name to its `GoogleFonts` text theme function. |
49 |
| - |
50 |
| -<Aside> |
51 |
| -For a deep dive into the capabilities of `flex_color_scheme`, please refer to its excellent [official documentation](https://docs.flexcolorscheme.com/). |
| 14 | +[**Guide: Customizing the UI Theme →**](/docs/architecture/03-guide-customizing-the-ui/) |
52 | 15 | </Aside>
|
| 16 | + |
| 17 | +This approach ensures that you learn the correct workflow for modifying shared code, which is the key to unlocking the full power of the toolkit. |
0 commit comments