mirror of
https://github.com/BetterAndroid/FlexiUI.git
synced 2025-12-12 09:13:36 +08:00
feat: add LocalInSurface in Surface
This commit is contained in:
@@ -32,6 +32,7 @@ import androidx.compose.runtime.Composable
|
|||||||
import androidx.compose.runtime.CompositionLocalProvider
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
import androidx.compose.runtime.Immutable
|
import androidx.compose.runtime.Immutable
|
||||||
import androidx.compose.runtime.ReadOnlyComposable
|
import androidx.compose.runtime.ReadOnlyComposable
|
||||||
|
import androidx.compose.runtime.compositionLocalOf
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.composed
|
import androidx.compose.ui.composed
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
@@ -54,6 +55,7 @@ fun Surface(
|
|||||||
content: @Composable BoxScope.() -> Unit
|
content: @Composable BoxScope.() -> Unit
|
||||||
) {
|
) {
|
||||||
CompositionLocalProvider(
|
CompositionLocalProvider(
|
||||||
|
LocalInSurface provides true,
|
||||||
LocalColors provides LocalColors.current.copy(
|
LocalColors provides LocalColors.current.copy(
|
||||||
backgroundPrimary = colors.backgroundColor,
|
backgroundPrimary = colors.backgroundColor,
|
||||||
textPrimary = colors.contentColor
|
textPrimary = colors.contentColor
|
||||||
@@ -90,6 +92,8 @@ object Surface {
|
|||||||
get() = defaultSurfacePadding()
|
get() = defaultSurfacePadding()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal val LocalInSurface = compositionLocalOf { false }
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@ReadOnlyComposable
|
@ReadOnlyComposable
|
||||||
private fun defaultSurfaceColors() = SurfaceColors(
|
private fun defaultSurfaceColors() = SurfaceColors(
|
||||||
|
|||||||
Reference in New Issue
Block a user