From 4f24b2574c007d6e5e6d1d3b50000a3b6af481e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=99=E7=A9=BA?= <70465933+YuKongA@users.noreply.github.com> Date: Wed, 28 Aug 2024 18:38:51 +0800 Subject: [PATCH] example: Opt padding --- composeApp/src/commonMain/kotlin/UITest.kt | 16 ++++++++-------- .../kotlin/component/OtherComponent.kt | 8 ++++---- .../kotlin/component/SecondComponent.kt | 4 +--- .../yukonga/miuix/kmp/theme/MiuixTextStyle.kt | 6 +++--- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/UITest.kt b/composeApp/src/commonMain/kotlin/UITest.kt index c58612f..c6914c6 100644 --- a/composeApp/src/commonMain/kotlin/UITest.kt +++ b/composeApp/src/commonMain/kotlin/UITest.kt @@ -5,9 +5,9 @@ import androidx.compose.foundation.layout.statusBarsPadding import androidx.compose.foundation.pager.PagerState import androidx.compose.foundation.pager.rememberPagerState import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.Email -import androidx.compose.material.icons.filled.Phone -import androidx.compose.material.icons.filled.Settings +import androidx.compose.material.icons.rounded.Home +import androidx.compose.material.icons.rounded.Settings +import androidx.compose.material.icons.rounded.Star import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.runtime.Composable @@ -64,9 +64,9 @@ fun UITest( } val items = listOf( - NavigationItem("Main", Icons.Default.Phone), - NavigationItem("Second", Icons.Default.Email), - NavigationItem("Settings", Icons.Default.Settings) + NavigationItem("HomePage", Icons.Rounded.Home), + NavigationItem("DropDown", Icons.Rounded.Star), + NavigationItem("Settings", Icons.Rounded.Settings) ) LaunchedEffect(pagerState) { @@ -94,7 +94,7 @@ fun UITest( MiuixTopAppBar( navigationIcon = { IconButton( - modifier = Modifier.padding(start = 12.dp), + modifier = Modifier.padding(start = 16.dp), onClick = {} ) { Icon( @@ -106,7 +106,7 @@ fun UITest( }, actions = { IconButton( - modifier = Modifier.padding(end = 12.dp), + modifier = Modifier.padding(end = 16.dp), onClick = { uriHandler.openUri("https://github.com/miuix-kotlin-multiplatform/miuix") } diff --git a/composeApp/src/commonMain/kotlin/component/OtherComponent.kt b/composeApp/src/commonMain/kotlin/component/OtherComponent.kt index 547f037..f1ea053 100644 --- a/composeApp/src/commonMain/kotlin/component/OtherComponent.kt +++ b/composeApp/src/commonMain/kotlin/component/OtherComponent.kt @@ -35,7 +35,7 @@ fun OtherComponent(padding: PaddingValues) { value = text, onValueChange = { text = it }, label = "Text Field", - modifier = Modifier.padding(28.dp), + modifier = Modifier.padding(horizontal = 28.dp, vertical = 20.dp), keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }), keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done), ) @@ -45,7 +45,7 @@ fun OtherComponent(padding: PaddingValues) { onProgressChange = { newProgress -> progress = newProgress }, modifier = Modifier .padding(horizontal = 28.dp) - .padding(bottom = 28.dp) + .padding(bottom = 20.dp) ) MiuixSlider( @@ -54,14 +54,14 @@ fun OtherComponent(padding: PaddingValues) { enabled = false, modifier = Modifier .padding(horizontal = 28.dp) - .padding(bottom = 28.dp) + .padding(bottom = 20.dp) ) MiuixCard( modifier = Modifier .fillMaxWidth() .padding(horizontal = 28.dp) - .padding(bottom = 28.dp + padding.calculateBottomPadding()) + .padding(bottom = 20.dp + padding.calculateBottomPadding()) ) { MiuixText( text = "Card", diff --git a/composeApp/src/commonMain/kotlin/component/SecondComponent.kt b/composeApp/src/commonMain/kotlin/component/SecondComponent.kt index 7307cb7..3ff5841 100644 --- a/composeApp/src/commonMain/kotlin/component/SecondComponent.kt +++ b/composeApp/src/commonMain/kotlin/component/SecondComponent.kt @@ -66,7 +66,6 @@ fun SecondComponent() { ) } - MiuixSuperCheckbox( title = "Checkbox", summary = miuixSuperCheckbox, @@ -119,8 +118,7 @@ fun SecondComponent() { Row( modifier = Modifier .fillMaxWidth() - .padding(horizontal = 28.dp) - .padding(bottom = 20.dp), + .padding(horizontal = 28.dp, vertical = 20.dp), horizontalArrangement = Arrangement.SpaceBetween ) { MiuixButton( diff --git a/miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/theme/MiuixTextStyle.kt b/miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/theme/MiuixTextStyle.kt index 5a1d1ae..99a3bb2 100644 --- a/miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/theme/MiuixTextStyle.kt +++ b/miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/theme/MiuixTextStyle.kt @@ -30,17 +30,17 @@ fun miuixTextStyles( paragraph = paragraph ) -val DefaultTextStyle: TextStyle +private val DefaultTextStyle: TextStyle get() = TextStyle( fontSize = 16.sp, ) -val TitleTextStyle: TextStyle +private val TitleTextStyle: TextStyle get() = TextStyle( fontSize = 12.sp ) -val ParagraphTextStyle: TextStyle +private val ParagraphTextStyle: TextStyle get() = TextStyle( fontSize = 16.sp, lineHeight = 1.2f.em