Created
September 18, 2024 10:44
-
-
Save NikolaDespotoski/b6a09a8c27b071fe290facd7e0e5011b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val ModifierLocalMyScope = | |
modifierLocalOf<MyScope> { error("Scope not provided") } | |
@Composable | |
fun MyLayout( | |
modifier: Modifier = Modifier, | |
properties: MyProperties = MyProperties(), | |
colors: MyLayoutColors = MyLayoutDefaults.colors(), | |
content: @Composable (MyScope.() -> Unit) | |
) { | |
val scope = rememberMyScope(properties) | |
Surface(modifier = Modifier.fillMaxSize() | |
.modifierLocalProvider(ModifierLocalMyScope) { scope } | |
.then(modifier) | |
) { | |
scope.content() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment