Skip to content

Commit 0ed3625

Browse files
committed
1 parent e06b1ae commit 0ed3625

File tree

12 files changed

+190
-30
lines changed

12 files changed

+190
-30
lines changed

composeApp/src/commonMain/kotlin/component/TextComponent.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,13 @@ import androidx.compose.animation.fadeIn
66
import androidx.compose.animation.fadeOut
77
import androidx.compose.animation.shrinkVertically
88
import androidx.compose.foundation.Image
9-
import androidx.compose.foundation.background
109
import androidx.compose.foundation.layout.Arrangement
1110
import androidx.compose.foundation.layout.Row
1211
import androidx.compose.foundation.layout.Spacer
1312
import androidx.compose.foundation.layout.fillMaxWidth
1413
import androidx.compose.foundation.layout.height
1514
import androidx.compose.foundation.layout.padding
16-
import androidx.compose.foundation.layout.size
1715
import androidx.compose.foundation.layout.width
18-
import androidx.compose.foundation.shape.RoundedCornerShape
1916
import androidx.compose.material.icons.Icons
2017
import androidx.compose.material.icons.filled.Star
2118
import androidx.compose.runtime.Composable
@@ -26,7 +23,6 @@ import androidx.compose.runtime.remember
2623
import androidx.compose.runtime.setValue
2724
import androidx.compose.ui.Alignment
2825
import androidx.compose.ui.Modifier
29-
import androidx.compose.ui.draw.clip
3026
import androidx.compose.ui.graphics.ColorFilter
3127
import androidx.compose.ui.unit.dp
3228
import top.yukonga.miuix.kmp.basic.BasicComponent

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/Button.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import androidx.compose.foundation.layout.Arrangement
44
import androidx.compose.foundation.layout.Row
55
import androidx.compose.foundation.layout.defaultMinSize
66
import androidx.compose.foundation.layout.padding
7-
import androidx.compose.foundation.shape.RoundedCornerShape
87
import androidx.compose.runtime.Composable
98
import androidx.compose.runtime.getValue
109
import androidx.compose.runtime.rememberUpdatedState
@@ -20,6 +19,7 @@ import androidx.compose.ui.text.font.FontWeight
2019
import androidx.compose.ui.unit.Dp
2120
import androidx.compose.ui.unit.dp
2221
import top.yukonga.miuix.kmp.theme.MiuixTheme
22+
import top.yukonga.miuix.kmp.utils.SmoothRoundedCornerShape
2323

2424
/**
2525
* A button component with Miuix style.
@@ -51,7 +51,7 @@ fun Button(
5151
},
5252
enabled = enabled,
5353
modifier = modifier.semantics { role = Role.Button },
54-
shape = RoundedCornerShape(cornerRadius),
54+
shape = SmoothRoundedCornerShape(cornerRadius),
5555
color = color
5656
) {
5757
Row(

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/Card.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package top.yukonga.miuix.kmp.basic
33
import androidx.compose.foundation.layout.Column
44
import androidx.compose.foundation.layout.ColumnScope
55
import androidx.compose.foundation.layout.padding
6-
import androidx.compose.foundation.shape.RoundedCornerShape
76
import androidx.compose.runtime.Composable
87
import androidx.compose.runtime.remember
98
import androidx.compose.ui.Modifier
@@ -12,6 +11,7 @@ import androidx.compose.ui.unit.Dp
1211
import androidx.compose.ui.unit.DpSize
1312
import androidx.compose.ui.unit.dp
1413
import top.yukonga.miuix.kmp.theme.MiuixTheme
14+
import top.yukonga.miuix.kmp.utils.SmoothRoundedCornerShape
1515

1616
/**
1717
* A card component with Miuix style.
@@ -33,7 +33,7 @@ fun Card(
3333
color: Color = MiuixTheme.colorScheme.surface,
3434
content: @Composable ColumnScope.() -> Unit
3535
) {
36-
val shape = remember { RoundedCornerShape(cornerRadius) }
36+
val shape = remember { SmoothRoundedCornerShape(cornerRadius) }
3737
val paddingModifier = remember(insideMargin) {
3838
Modifier.padding(vertical = insideMargin.height, horizontal = insideMargin.width)
3939
}

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/Checkbox.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import androidx.compose.ui.platform.LocalHapticFeedback
3333
import androidx.compose.ui.semantics.Role
3434
import androidx.compose.ui.unit.dp
3535
import top.yukonga.miuix.kmp.theme.MiuixTheme
36+
import top.yukonga.miuix.kmp.utils.SmoothRoundedCornerShape
3637

3738
/**
3839
* A checkbox component with Miuix style.
@@ -87,7 +88,7 @@ fun Checkbox(
8788
modifier = modifier
8889
.wrapContentSize(Alignment.Center)
8990
.size(22.dp)
90-
.clip(RoundedCornerShape(100f))
91+
.clip(RoundedCornerShape(100.dp))
9192
.requiredSize(checkboxSize)
9293
.pointerInput(Unit) {
9394
detectTapGestures(

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/FloatingActionButton.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
package top.yukonga.miuix.kmp.basic
22

3-
import androidx.compose.foundation.Indication
4-
import androidx.compose.foundation.LocalIndication
5-
import androidx.compose.foundation.interaction.MutableInteractionSource
63
import androidx.compose.foundation.layout.Box
74
import androidx.compose.foundation.layout.defaultMinSize
85
import androidx.compose.foundation.shape.RoundedCornerShape
96
import androidx.compose.runtime.Composable
10-
import androidx.compose.runtime.remember
117
import androidx.compose.ui.Alignment
128
import androidx.compose.ui.Modifier
9+
import androidx.compose.ui.geometry.Rect
1310
import androidx.compose.ui.graphics.Color
1411
import androidx.compose.ui.graphics.Shape
1512
import androidx.compose.ui.semantics.Role
1613
import androidx.compose.ui.semantics.role
1714
import androidx.compose.ui.semantics.semantics
1815
import androidx.compose.ui.unit.dp
1916
import top.yukonga.miuix.kmp.theme.MiuixTheme
17+
import top.yukonga.miuix.kmp.utils.SmoothRoundedCornerShape
2018

2119
/**
2220
* A floating action button component with Miuix style.
@@ -32,7 +30,7 @@ import top.yukonga.miuix.kmp.theme.MiuixTheme
3230
fun FloatingActionButton(
3331
modifier: Modifier = Modifier,
3432
onClick: () -> Unit,
35-
shape: Shape = RoundedCornerShape(50.dp),
33+
shape: Shape = RoundedCornerShape(60.dp),
3634
containerColor: Color = MiuixTheme.colorScheme.primary,
3735
shadowElevation: Float = 18f,
3836
content: @Composable () -> Unit,

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/SearchBar.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import androidx.compose.foundation.layout.ColumnScope
1010
import androidx.compose.foundation.layout.Row
1111
import androidx.compose.foundation.layout.fillMaxWidth
1212
import androidx.compose.foundation.layout.padding
13-
import androidx.compose.foundation.shape.RoundedCornerShape
1413
import androidx.compose.foundation.text.BasicTextField
1514
import androidx.compose.foundation.text.KeyboardActions
1615
import androidx.compose.foundation.text.KeyboardOptions
@@ -33,6 +32,7 @@ import androidx.compose.ui.zIndex
3332
import kotlinx.coroutines.delay
3433
import top.yukonga.miuix.kmp.theme.MiuixTheme
3534
import top.yukonga.miuix.kmp.utils.BackHandler
35+
import top.yukonga.miuix.kmp.utils.SmoothRoundedCornerShape
3636

3737
/**
3838
* A search bar with Miuix style.
@@ -164,7 +164,7 @@ fun InputField(
164164
modifier = Modifier
165165
.background(
166166
color = MiuixTheme.colorScheme.surfaceContainerHigh,
167-
shape = RoundedCornerShape(50.dp)
167+
shape = SmoothRoundedCornerShape(50.dp)
168168
)
169169
) {
170170
Row(

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/Slider.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import androidx.compose.foundation.background
55
import androidx.compose.foundation.gestures.detectHorizontalDragGestures
66
import androidx.compose.foundation.layout.fillMaxWidth
77
import androidx.compose.foundation.layout.height
8-
import androidx.compose.foundation.shape.RoundedCornerShape
98
import androidx.compose.runtime.Composable
109
import androidx.compose.runtime.getValue
1110
import androidx.compose.runtime.mutableStateOf
@@ -25,6 +24,7 @@ import androidx.compose.ui.platform.LocalHapticFeedback
2524
import androidx.compose.ui.unit.Dp
2625
import androidx.compose.ui.unit.dp
2726
import top.yukonga.miuix.kmp.theme.MiuixTheme
27+
import top.yukonga.miuix.kmp.utils.SmoothRoundedCornerShape
2828
import kotlin.math.pow
2929
import kotlin.math.round
3030

@@ -104,6 +104,7 @@ fun Slider(
104104
) {
105105
SliderBackground(
106106
modifier = Modifier.fillMaxWidth().height(height),
107+
height = height,
107108
backgroundColor = backgroundColor.value,
108109
foregroundColor = foregroundColor.value,
109110
effect = effect,
@@ -117,14 +118,15 @@ fun Slider(
117118
@Composable
118119
fun SliderBackground(
119120
modifier: Modifier,
121+
height: Dp = 30.dp,
120122
backgroundColor: Color,
121123
foregroundColor: Color,
122124
effect: Boolean,
123125
progress: Float,
124126
minValue: Float,
125127
maxValue: Float,
126128
) {
127-
Canvas(modifier = modifier.clip(RoundedCornerShape(100.dp)).background(backgroundColor)) {
129+
Canvas(modifier = modifier.clip(SmoothRoundedCornerShape(height)).background(backgroundColor)) {
128130
val barHeight = size.height
129131
val barWidth = size.width
130132
val progressWidth = barWidth * ((progress - minValue) / (maxValue - minValue))

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/Switch.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import androidx.compose.ui.semantics.Role
2929
import androidx.compose.ui.unit.Dp
3030
import androidx.compose.ui.unit.dp
3131
import top.yukonga.miuix.kmp.theme.MiuixTheme
32+
import top.yukonga.miuix.kmp.utils.SmoothRoundedCornerShape
3233
import kotlin.math.absoluteValue
3334

3435
/**
@@ -105,7 +106,7 @@ fun Switch(
105106
.wrapContentSize(Alignment.Center)
106107
.size(52.dp, 28.5.dp)
107108
.requiredSize(52.dp, 28.5.dp)
108-
.clip(RoundedCornerShape(100.dp))
109+
.clip(SmoothRoundedCornerShape(52.dp))
109110
.background(if (enabled) backgroundColor else disabledBackgroundColor)
110111
.pointerInput(Unit) {
111112
detectHorizontalDragGestures(

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/TextField.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import androidx.compose.foundation.layout.Row
1010
import androidx.compose.foundation.layout.fillMaxWidth
1111
import androidx.compose.foundation.layout.offset
1212
import androidx.compose.foundation.layout.padding
13-
import androidx.compose.foundation.shape.RoundedCornerShape
1413
import androidx.compose.foundation.text.BasicTextField
1514
import androidx.compose.foundation.text.KeyboardActions
1615
import androidx.compose.foundation.text.KeyboardOptions
@@ -32,6 +31,7 @@ import androidx.compose.ui.unit.DpSize
3231
import androidx.compose.ui.unit.dp
3332
import androidx.compose.ui.unit.sp
3433
import top.yukonga.miuix.kmp.theme.MiuixTheme
34+
import top.yukonga.miuix.kmp.utils.SmoothRoundedCornerShape
3535

3636
/**
3737
* A text field component with Miuix style.
@@ -98,7 +98,7 @@ fun TextField(
9898
val labelOffsetY by animateDpAsState(if (value.text.isNotEmpty()) -(insideMargin.height / 2) else 0.dp)
9999
val innerTextOffsetY by animateDpAsState(if (value.text.isNotEmpty()) (insideMargin.height / 2) else 0.dp)
100100
val labelFontSize by animateDpAsState(if (value.text.isNotEmpty()) 10.dp else 16.dp)
101-
val border = Modifier.border(borderWidth, borderColor, RoundedCornerShape(cornerRadius))
101+
val border = Modifier.border(borderWidth, borderColor, SmoothRoundedCornerShape(cornerRadius))
102102
val labelOffset = if (label != "") Modifier.offset(y = labelOffsetY) else Modifier
103103
val innerTextOffset = if (label != "") Modifier.offset(y = innerTextOffsetY) else Modifier
104104

@@ -124,7 +124,7 @@ fun TextField(
124124
.fillMaxWidth()
125125
.background(
126126
color = backgroundColor,
127-
shape = RoundedCornerShape(cornerRadius)
127+
shape = SmoothRoundedCornerShape(cornerRadius)
128128
)
129129
.then(border)
130130
) {
@@ -228,7 +228,7 @@ fun TextField(
228228
val labelOffsetY by animateDpAsState(if (value.isNotEmpty()) -(insideMargin.height / 2) else 0.dp)
229229
val innerTextOffsetY by animateDpAsState(if (value.isNotEmpty()) (insideMargin.height / 2) else 0.dp)
230230
val labelFontSize by animateDpAsState(if (value.isNotEmpty()) 10.dp else 16.dp)
231-
val border = Modifier.border(borderWidth, borderColor, RoundedCornerShape(cornerRadius))
231+
val border = Modifier.border(borderWidth, borderColor, SmoothRoundedCornerShape(cornerRadius))
232232
val labelOffset = if (label != "") Modifier.offset(y = labelOffsetY) else Modifier
233233
val innerTextOffset = if (label != "") Modifier.offset(y = innerTextOffsetY) else Modifier
234234

@@ -254,7 +254,7 @@ fun TextField(
254254
.fillMaxWidth()
255255
.background(
256256
color = backgroundColor,
257-
shape = RoundedCornerShape(cornerRadius)
257+
shape = SmoothRoundedCornerShape(cornerRadius)
258258
)
259259
.then(border)
260260
) {

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/extra/SuperDialog.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import androidx.compose.foundation.layout.imePadding
99
import androidx.compose.foundation.layout.navigationBarsPadding
1010
import androidx.compose.foundation.layout.padding
1111
import androidx.compose.foundation.layout.widthIn
12-
import androidx.compose.foundation.shape.RoundedCornerShape
1312
import androidx.compose.runtime.Composable
1413
import androidx.compose.runtime.LaunchedEffect
1514
import androidx.compose.runtime.MutableState
@@ -36,6 +35,7 @@ import top.yukonga.miuix.kmp.theme.MiuixTheme
3635
import top.yukonga.miuix.kmp.utils.BackHandler
3736
import top.yukonga.miuix.kmp.utils.MiuixPopupUtil.Companion.isDialogShowing
3837
import top.yukonga.miuix.kmp.utils.MiuixPopupUtil.Companion.showDialog
38+
import top.yukonga.miuix.kmp.utils.SmoothRoundedCornerShape
3939
import top.yukonga.miuix.kmp.utils.getRoundedCorner
4040
import top.yukonga.miuix.kmp.utils.getWindowSize
4141

@@ -119,12 +119,12 @@ fun SuperDialog(
119119
}
120120
.align(contentAlignment.invoke().value)
121121
.graphicsLayer(
122-
shape = RoundedCornerShape(bottomCornerRadius),
122+
shape = SmoothRoundedCornerShape(bottomCornerRadius),
123123
clip = false
124124
)
125125
.background(
126126
color = backgroundColor,
127-
shape = RoundedCornerShape(bottomCornerRadius)
127+
shape = SmoothRoundedCornerShape(bottomCornerRadius)
128128
)
129129
.padding(insideMargin),
130130
) {

0 commit comments

Comments
 (0)