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