Skip to content

Commit

Permalink
example: Opt padding
Browse files Browse the repository at this point in the history
  • Loading branch information
YuKongA committed Aug 28, 2024
1 parent b78977e commit 4f24b25
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
16 changes: 8 additions & 8 deletions composeApp/src/commonMain/kotlin/UITest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -94,7 +94,7 @@ fun UITest(
MiuixTopAppBar(
navigationIcon = {
IconButton(
modifier = Modifier.padding(start = 12.dp),
modifier = Modifier.padding(start = 16.dp),
onClick = {}
) {
Icon(
Expand All @@ -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")
}
Expand Down
8 changes: 4 additions & 4 deletions composeApp/src/commonMain/kotlin/component/OtherComponent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)
Expand All @@ -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(
Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ fun SecondComponent() {
)
}


MiuixSuperCheckbox(
title = "Checkbox",
summary = miuixSuperCheckbox,
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4f24b25

Please sign in to comment.