mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 17:37:05 +05:30
common: add CompositionLocal
support to LobstersTheme
This commit is contained in:
parent
67893552e7
commit
26a96d9116
1 changed files with 17 additions and 9 deletions
|
@ -5,6 +5,8 @@ import androidx.compose.material.Typography
|
||||||
import androidx.compose.material.darkColors
|
import androidx.compose.material.darkColors
|
||||||
import androidx.compose.material.lightColors
|
import androidx.compose.material.lightColors
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
|
import androidx.compose.runtime.ProvidedValue
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.text.font.FontFamily
|
import androidx.compose.ui.text.font.FontFamily
|
||||||
|
|
||||||
|
@ -37,7 +39,12 @@ val darkColors =
|
||||||
)
|
)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun LobstersTheme(darkTheme: Boolean, children: @Composable () -> Unit) {
|
fun LobstersTheme(
|
||||||
|
darkTheme: Boolean,
|
||||||
|
providedValues: Array<ProvidedValue<*>> = emptyArray(),
|
||||||
|
children: @Composable () -> Unit
|
||||||
|
) {
|
||||||
|
CompositionLocalProvider(*providedValues) {
|
||||||
MaterialTheme(
|
MaterialTheme(
|
||||||
colors = if (darkTheme) darkColors else lightColors,
|
colors = if (darkTheme) darkColors else lightColors,
|
||||||
typography =
|
typography =
|
||||||
|
@ -47,3 +54,4 @@ fun LobstersTheme(darkTheme: Boolean, children: @Composable () -> Unit) {
|
||||||
content = children,
|
content = children,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue