You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| Data Flows | Ktor HTTP Client |[Link](docs/Data%20Flows/Ktor%20HTTP%20Client/overview.md)| - |[Link](docs/Data%20Flows/Ktor%20HTTP%20Client/usage.md)|
160
161
| Data Flows | Korlibs Crypto Library |[Link](docs/Data%20Flows/Korlibs%20Crypto%20Library/overview.md)| - |[Link](docs/Data%20Flows/Korlibs%20Crypto%20Library/usage.md)|
161
162
| Data Flows | Basic Cache API |[Link](docs/Data%20Flows/Basic%20Cache%20API/overview.md)| - |[Link](docs/Data%20Flows/Basic%20Cache%20API/usage.md)|
162
163
| Data Flows | Basic Config API |[Link](docs/Data%20Flows/Basic%20Config%20API/overview.md)| - |[Link](docs/Data%20Flows/Basic%20Config%20API/usage.md)|
163
164
| Data Flows | SQLDelight |[Link](docs/Data%20Flows/SQLDelight/overview.md)| - |[Link](docs/Data%20Flows/SQLDelight/usage.md)|
164
165
| Data Flows | SQLite (Jetpack Room) |[Link](docs/Data%20Flows/SQLite%20%28Jetpack%20Room%29/overview.md)| - |[Link](docs/Data%20Flows/SQLite%20%28Jetpack%20Room%29/usage.md)|
165
-
| Data Flows | Ktor HTTP Client |[Link](docs/Data%20Flows/Ktor%20HTTP%20Client/overview.md)| - |[Link](docs/Data%20Flows/Ktor%20HTTP%20Client/usage.md)|
166
166
| Data Flows | Multiplatform Paging Library |[Link](docs/Data%20Flows/Multiplatform%20Paging%20Library/overview.md)| - |[Link](docs/Data%20Flows/Multiplatform%20Paging%20Library/usage.md)|
167
167
| Data Flows | Basic Analytics API |[Link](docs/Data%20Flows/Basic%20Analytics%20API/overview.md)| - |[Link](docs/Data%20Flows/Basic%20Analytics%20API/usage.md)|
168
168
| Data Flows | Gemini AI |[Link](docs/Data%20Flows/Gemini%20AI/overview.md)| - |[Link](docs/Data%20Flows/Gemini%20AI/usage.md)|
@@ -179,11 +179,11 @@ The generated project will include a similar table in its README.MD file, but wi
179
179
| User Flows | Toggle Theme Button |[Link](docs/User%20Flows/Toggle%20Theme%20Button/overview.md)| - |[Link](docs/User%20Flows/Toggle%20Theme%20Button/usage.md)|
180
180
| User Flows | Auth Flow |[Link](docs/User%20Flows/Auth%20Flow/overview.md)| - |[Link](docs/User%20Flows/Auth%20Flow/usage.md)|
181
181
| User Flows | Passcode Flow |[Link](docs/User%20Flows/Passcode%20Flow/overview.md)| - |[Link](docs/User%20Flows/Passcode%20Flow/usage.md)|
182
-
| User Flows | Placeholder UI |[Link](docs/User%20Flows/Placeholder%20UI/overview.md)| - |[Link](docs/User%20Flows/Placeholder%20UI/usage.md)|
183
182
| User Flows | FileKit |[Link](docs/User%20Flows/FileKit/overview.md)| - |[Link](docs/User%20Flows/FileKit/usage.md)|
184
183
| Dev Tools | kotlin-logging |[Link](docs/Dev%20Tools/kotlin-logging/overview.md)| - |[Link](docs/Dev%20Tools/kotlin-logging/usage.md)|
185
184
| Dev Tools | Kermit |[Link](docs/Dev%20Tools/Kermit/overview.md)| - |[Link](docs/Dev%20Tools/Kermit/usage.md)|
186
185
| Dev Tools | Napier |[Link](docs/Dev%20Tools/Napier/overview.md)| - |[Link](docs/Dev%20Tools/Napier/usage.md)|
186
+
| Dev Tools | Compose Hot Reload |[Link](docs/Dev%20Tools/Compose%20Hot%20Reload/overview.md)| - |[Link](docs/Dev%20Tools/Compose%20Hot%20Reload/usage.md)|
Copy file name to clipboardExpand all lines: docs/Base Setup/Material 3/usage.md
+35-13Lines changed: 35 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,40 +6,62 @@
6
6
- State management: `shared.presentation.theme.ThemeState`
7
7
- Integration config: `app.theme.ThemeConfig`
8
8
9
-
This state instance is utilized by `app.theme.provide.presentation.ThemeProvider`, which is pre-defined at the app level to furnish themes for the entire application.
9
+
This state instance is utilized by `app.theme.provide.presentation.ThemeProvider`, which is pre-defined at the app level
10
+
to furnish themes for the entire application.
10
11
11
12
```kotlin
12
13
@Composable
13
14
funApp() =ViewModelProvider({ app() }) {
14
-
ThemeProvider {
15
-
AppScreen()
15
+
ThemeProvider {
16
+
AppScreen()
17
+
}
16
18
}
17
-
}
18
19
```
19
20
20
21
## Change Themes
21
22
22
-
By default, `ThemeState` is initialized with pre-defined dark and light themes in the `presentation` module. To edit these themes:
23
+
By default, `ThemeState` is initialized with pre-defined dark and light themes in the `app.theme` package of `app`
24
+
module.
25
+
26
+
```kotlin
27
+
val theme = module {
28
+
single<ThemeState> {
29
+
DefaultThemeState(
30
+
defaultConfig =ThemeConfig(
31
+
defaultTheme =DsThemes.Light,
32
+
lightTheme =DsThemes.Light,
33
+
darkTheme =DsThemes.Dark,
34
+
)
35
+
)
36
+
}
37
+
}
38
+
```
39
+
40
+
The themes itself are declared in `shared:presentation` module as part of the **design system**.
41
+
42
+
To edit these themes:
23
43
24
44
1. Visit the [Material 3 Theme Builder](https://m3.material.io/theme-builder#/custom).
25
45
2. Customize the desired color theme.
26
46
3. Click on the **Export** button and confirm exporting as **Jetpack Compose (Theme.kt)**.
27
-
4. Paste the exported files (**Theme.kt** and **Color.kt**) into the package `shared.presentation.theme.m3` of the `presentation` module and update their package declaration accordingly.
28
-
5. In the `Themes.kt` file add the following snippet:
47
+
4. Paste the exported files (**Theme.kt** and **Color.kt**) into the package `shared.presentation.ui.theme.m3` of the
48
+
`shared:presentation` module and update their package declaration accordingly.
49
+
5. In the `shared.presentation.ui.theme.DsThemes` file add the following snippet:
29
50
```kotlin
30
-
objectThemes {
31
-
valLight=Theme(
51
+
objectDsThemes {
52
+
valLight=DsTheme(
32
53
dark =false,
33
-
id ="material_3_light",
54
+
id ="light",
34
55
colorScheme = lightScheme
35
56
)
36
57
37
-
valDark=Theme(
58
+
valDark=DsTheme(
38
59
dark =true,
39
-
id ="material_3_dark",
60
+
id ="dark",
40
61
colorScheme = darkScheme
41
62
)
42
63
}
43
64
```
44
65
45
-
The themes can be declared directly in the app module. However, if you plan to use feature modules, it might be beneficial to declare the theme in the `presentation` module.
66
+
The themes can be declared directly in the `app` module. However, if you plan to use feature modules, it might be
67
+
beneficial to declare the theme in the `shared:presentation` module.
Make changes to your UI code in a Compose Multiplatform application and see the results in real time. No restarts required. Compose Hot Reload runs your application on the JetBrains Runtime and intelligently reloads your code whenever it is changed.
0 commit comments