From d2f1a94e7a8548fee862469ae07964e492dd4959 Mon Sep 17 00:00:00 2001 From: YuKongA <70465933+YuKongA@users.noreply.github.com> Date: Sat, 19 Oct 2024 13:06:52 +0800 Subject: [PATCH] example: Add Card to Dropdown Page --- composeApp/src/commonMain/kotlin/MainPage.kt | 3 +- .../src/commonMain/kotlin/SecondPage.kt | 28 +++++++++++-------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/MainPage.kt b/composeApp/src/commonMain/kotlin/MainPage.kt index 8d4e564..9bba80c 100644 --- a/composeApp/src/commonMain/kotlin/MainPage.kt +++ b/composeApp/src/commonMain/kotlin/MainPage.kt @@ -55,7 +55,8 @@ fun MainPage( ) { item { SearchBar( - modifier = Modifier.padding(horizontal = 12.dp, vertical = 10.dp), + modifier = Modifier + .padding(start = 12.dp, end = 12.dp, top = 12.dp, bottom = 6.dp), inputField = { InputField( query = miuixSearchValue, diff --git a/composeApp/src/commonMain/kotlin/SecondPage.kt b/composeApp/src/commonMain/kotlin/SecondPage.kt index 79d12a3..46c4524 100644 --- a/composeApp/src/commonMain/kotlin/SecondPage.kt +++ b/composeApp/src/commonMain/kotlin/SecondPage.kt @@ -1,11 +1,11 @@ import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp +import top.yukonga.miuix.kmp.basic.Card import top.yukonga.miuix.kmp.basic.LazyColumn import top.yukonga.miuix.kmp.basic.ScrollBehavior import top.yukonga.miuix.kmp.extra.SuperDropdown @@ -22,17 +22,21 @@ fun SecondPage( contentPadding = PaddingValues(top = padding.calculateTopPadding()), topAppBarScrollBehavior = topAppBarScrollBehavior ) { - items(20) { - SuperDropdown( - title = "Dropdown", - summary = "Popup near click", - items = dropdownOptions, - selectedIndex = dropdownSelectedOption.value, - onSelectedIndexChange = { newOption -> dropdownSelectedOption.value = newOption } - ) - } item { - Spacer(modifier = Modifier.height(padding.calculateBottomPadding())) + Card( + modifier = Modifier + .padding(horizontal = 12.dp) + .padding(top = 12.dp, bottom = 12.dp + padding.calculateBottomPadding()) + ) { + for (i in 0 until 20) { + SuperDropdown( + title = "Dropdown", + items = dropdownOptions, + selectedIndex = dropdownSelectedOption.value, + onSelectedIndexChange = { newOption -> dropdownSelectedOption.value = newOption } + ) + } + } } } } \ No newline at end of file