Skip to content

Commit d2f1a94

Browse files
committed
example: Add Card to Dropdown Page
1 parent 122732c commit d2f1a94

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

composeApp/src/commonMain/kotlin/MainPage.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ fun MainPage(
5555
) {
5656
item {
5757
SearchBar(
58-
modifier = Modifier.padding(horizontal = 12.dp, vertical = 10.dp),
58+
modifier = Modifier
59+
.padding(start = 12.dp, end = 12.dp, top = 12.dp, bottom = 6.dp),
5960
inputField = {
6061
InputField(
6162
query = miuixSearchValue,
Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import androidx.compose.foundation.layout.PaddingValues
2-
import androidx.compose.foundation.layout.Spacer
3-
import androidx.compose.foundation.layout.height
2+
import androidx.compose.foundation.layout.padding
43
import androidx.compose.runtime.Composable
54
import androidx.compose.runtime.mutableStateOf
65
import androidx.compose.runtime.remember
76
import androidx.compose.ui.Modifier
87
import androidx.compose.ui.unit.dp
8+
import top.yukonga.miuix.kmp.basic.Card
99
import top.yukonga.miuix.kmp.basic.LazyColumn
1010
import top.yukonga.miuix.kmp.basic.ScrollBehavior
1111
import top.yukonga.miuix.kmp.extra.SuperDropdown
@@ -22,17 +22,21 @@ fun SecondPage(
2222
contentPadding = PaddingValues(top = padding.calculateTopPadding()),
2323
topAppBarScrollBehavior = topAppBarScrollBehavior
2424
) {
25-
items(20) {
26-
SuperDropdown(
27-
title = "Dropdown",
28-
summary = "Popup near click",
29-
items = dropdownOptions,
30-
selectedIndex = dropdownSelectedOption.value,
31-
onSelectedIndexChange = { newOption -> dropdownSelectedOption.value = newOption }
32-
)
33-
}
3425
item {
35-
Spacer(modifier = Modifier.height(padding.calculateBottomPadding()))
26+
Card(
27+
modifier = Modifier
28+
.padding(horizontal = 12.dp)
29+
.padding(top = 12.dp, bottom = 12.dp + padding.calculateBottomPadding())
30+
) {
31+
for (i in 0 until 20) {
32+
SuperDropdown(
33+
title = "Dropdown",
34+
items = dropdownOptions,
35+
selectedIndex = dropdownSelectedOption.value,
36+
onSelectedIndexChange = { newOption -> dropdownSelectedOption.value = newOption }
37+
)
38+
}
39+
}
3640
}
3741
}
3842
}

0 commit comments

Comments
 (0)