Skip to content

Commit 83ce685

Browse files
committed
Add a StyleScope.padding placeholder and update the demo code
1 parent 26f214b commit 83ce685

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

compose-multiplatform-common/src/commonMain/kotlin/com/huanshankeji/compose/ui/ModifierOrAttrsScope.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ expect class StyleScope {
1515
fun margin(value: SizeValue)
1616
}
1717

18+
private const val PADDING_MESSAGE =
19+
"This function is a placeholder for code completion. " +
20+
"Use `margin` to add space around the composable, which is equivalent to `Modifier.padding`. " +
21+
"Set `margin` in the inner composable to add inner padding."
22+
23+
@Deprecated(PADDING_MESSAGE)
24+
fun StyleScope.padding(value: SizeValue): Unit =
25+
throw NotImplementedError(PADDING_MESSAGE)
26+
1827
/*
1928
/** An alternative immutable design like [Modifier]. */
2029
expect class ModifierOrAttrsImmutable<T : Element> {

demo/src/commonMain/kotlin/com/huanshankeji/compose/material/demo/Composables.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ fun App() {
2424
margin(16.dpOrPx)
2525
}
2626
}) {
27-
Column {
27+
Column({
28+
style {
29+
margin(16.dpOrPx)
30+
}
31+
}) {
2832
BasicText("basic text")
2933
Text("Material text")
3034

0 commit comments

Comments
 (0)