Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ kotlin {
@Composable
fun App() {
MiuixTheme(
colorScheme = if (isSystemInDarkTheme()) darkColorScheme() else lightColorScheme()
colors = if (isSystemInDarkTheme()) darkColorScheme() else lightColorScheme()
) {
// Other content...
}
Expand Down
2 changes: 1 addition & 1 deletion composeApp/src/commonMain/kotlin/ui/Theme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fun AppTheme(
) {
val darkTheme = isSystemInDarkTheme()
return MiuixTheme(
colorScheme = when (colorMode) {
colors = when (colorMode) {
1 -> lightColorScheme()
2 -> darkColorScheme()
else -> if (darkTheme) darkColorScheme() else lightColorScheme()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import top.yukonga.miuix.kmp.utils.SmoothRoundedCornerShape
* @param enabled Whether the [Button] is enabled.
* @param submit Whether the [Button] is a submit button.
* @param cornerRadius The corner radius of the [Button].
* @param minHeight The minimum height of the [Button].
*/
@Composable
fun Button(
Expand All @@ -38,7 +39,8 @@ fun Button(
onClick: () -> Unit,
enabled: Boolean = true,
submit: Boolean = false,
cornerRadius: Dp = 18.dp
cornerRadius: Dp = 16.dp,
minHeight: Dp = 40.dp
) {
val hapticFeedback = LocalHapticFeedback.current
val color by rememberUpdatedState(getButtonColor(enabled, submit))
Expand All @@ -56,14 +58,15 @@ fun Button(
) {
Row(
Modifier
.defaultMinSize(minWidth = 58.dp, minHeight = 40.dp)
.defaultMinSize(minWidth = 58.dp, minHeight = minHeight)
.padding(16.dp, 16.dp),
horizontalArrangement = Arrangement.Center,
verticalAlignment = Alignment.CenterVertically,
) {
Text(
text = text,
color = textColor,
fontSize = MiuixTheme.textStyles.button.fontSize,
fontWeight = FontWeight.Medium
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import top.yukonga.miuix.kmp.utils.SmoothRoundedCornerShape
fun Card(
modifier: Modifier = Modifier,
insideMargin: DpSize = DpSize(0.dp, 0.dp),
cornerRadius: Dp = 18.dp,
cornerRadius: Dp = 16.dp,
color: Color = MiuixTheme.colorScheme.surface,
content: @Composable ColumnScope.() -> Unit
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
Expand Down Expand Up @@ -81,6 +82,7 @@ fun BasicComponent(
}
}
}
.heightIn(min = 56.dp)
.fillMaxWidth()
.then(paddingModifier),
verticalAlignment = Alignment.CenterVertically,
Expand All @@ -99,14 +101,15 @@ fun BasicComponent(
title?.let {
Text(
text = it,
fontSize = MiuixTheme.textStyles.headline1.fontSize,
fontWeight = FontWeight.Medium,
color = titleColor
)
}
summary?.let {
Text(
text = it,
fontSize = MiuixTheme.textStyles.title.fontSize,
fontSize = MiuixTheme.textStyles.body2.fontSize,
color = summaryColor
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import top.yukonga.miuix.kmp.theme.MiuixTheme

/**
Expand All @@ -32,7 +31,7 @@ fun SmallTitle(
Text(
modifier = modifier.then(paddingModifier),
text = text,
fontSize = 14.sp,
fontSize = MiuixTheme.textStyles.subtitle.fontSize,
fontWeight = FontWeight.Medium,
color = textColor
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@ fun TextField(
value: String,
onValueChange: (String) -> Unit,
modifier: Modifier = Modifier,
insideMargin: DpSize = DpSize(16.dp, 16.dp),
insideMargin: DpSize = DpSize(16.dp, 15.dp),
backgroundColor: Color = MiuixTheme.colorScheme.secondaryContainer,
cornerRadius: Dp = 18.dp,
cornerRadius: Dp = 16.dp,
label: String = "",
labelColor: Color = MiuixTheme.colorScheme.onSecondaryContainer,
enabled: Boolean = true,
Expand All @@ -223,7 +223,7 @@ fun TextField(
else Modifier.padding(vertical = insideMargin.height)
}
val isFocused by interactionSource.collectIsFocusedAsState()
val borderWidth by animateDpAsState(if (isFocused) 1.6.dp else 0.dp)
val borderWidth by animateDpAsState(if (isFocused) 2.0.dp else 0.dp)
val borderColor by animateColorAsState(if (isFocused) MiuixTheme.colorScheme.primary else backgroundColor)
val labelOffsetY by animateDpAsState(if (value.isNotEmpty()) -(insideMargin.height / 2) else 0.dp)
val innerTextOffsetY by animateDpAsState(if (value.isNotEmpty()) (insideMargin.height / 2) else 0.dp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.Velocity
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.util.fastFirst
import top.yukonga.miuix.kmp.theme.MiuixTheme
import kotlin.math.abs
Expand Down Expand Up @@ -524,7 +523,7 @@ private fun TopAppBarLayout(
Text(
text = title,
maxLines = 1,
fontSize = 20.sp,
fontSize = MiuixTheme.textStyles.title3.fontSize,
fontWeight = FontWeight.Medium
)
}
Expand All @@ -544,7 +543,7 @@ private fun TopAppBarLayout(
Text(
text = largeTitle,
maxLines = 1,
fontSize = 32.sp,
fontSize = MiuixTheme.textStyles.title1.fontSize,
fontWeight = FontWeight.Normal
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import top.yukonga.miuix.kmp.basic.BasicComponent
import top.yukonga.miuix.kmp.basic.Text
import top.yukonga.miuix.kmp.icon.MiuixIcons
Expand Down Expand Up @@ -60,15 +59,15 @@ fun SuperArrow(
if (rightText != null) {
Text(
text = rightText,
fontSize = 15.sp,
fontSize = MiuixTheme.textStyles.body2.fontSize,
color = MiuixTheme.colorScheme.onSurfaceVariantActions,
textAlign = TextAlign.End,
)
}
Image(
modifier = Modifier
.size(15.dp)
.padding(start = 6.dp),
.padding(start = 8.dp)
.size(10.dp, 16.dp),
imageVector = MiuixIcons.ArrowRight,
contentDescription = null,
colorFilter = BlendModeColorFilter(MiuixTheme.colorScheme.onSurfaceVariantActions, BlendMode.SrcIn),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import top.yukonga.miuix.kmp.basic.Box
import top.yukonga.miuix.kmp.basic.Text
import top.yukonga.miuix.kmp.theme.MiuixTheme
Expand Down Expand Up @@ -60,7 +59,7 @@ fun SuperDialog(
title: String? = null,
titleColor: Color = MiuixTheme.colorScheme.onSurface,
summary: String? = null,
summaryColor: Color = MiuixTheme.colorScheme.onSurfaceVariantDialog,
summaryColor: Color = MiuixTheme.colorScheme.onSurfaceSecondary,
backgroundColor: Color = MiuixTheme.colorScheme.surfaceVariant,
show: MutableState<Boolean>,
onDismissRequest: (() -> Unit)? = null,
Expand Down Expand Up @@ -129,18 +128,21 @@ fun SuperDialog(
) {
title?.let {
Text(
modifier = Modifier.fillMaxWidth().padding(bottom = 20.dp),
modifier = Modifier.fillMaxWidth()
.padding(start = 36.dp, end = 36.dp, bottom = 16.dp),
text = it,
fontSize = 20.sp,
fontSize = MiuixTheme.textStyles.title4.fontSize,
fontWeight = FontWeight.Medium,
textAlign = TextAlign.Center,
color = titleColor
)
}
summary?.let {
Text(
modifier = Modifier.fillMaxWidth().padding(bottom = 20.dp),
modifier = Modifier.fillMaxWidth()
.padding(start = 28.dp, end = 28.dp, bottom = 16.dp),
text = it,
fontSize = MiuixTheme.textStyles.body1.fontSize,
textAlign = TextAlign.Center,
color = summaryColor
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ import top.yukonga.miuix.kmp.basic.BasicComponent
import top.yukonga.miuix.kmp.basic.Box
import top.yukonga.miuix.kmp.basic.Text
import top.yukonga.miuix.kmp.icon.MiuixIcons
import top.yukonga.miuix.kmp.icon.icons.ArrowUpDown
import top.yukonga.miuix.kmp.icon.icons.ArrowUpDownIntegrated
import top.yukonga.miuix.kmp.icon.icons.Check
import top.yukonga.miuix.kmp.theme.MiuixTheme
import top.yukonga.miuix.kmp.utils.BackHandler
Expand Down Expand Up @@ -168,17 +168,18 @@ fun SuperDropdown(
summaryColor = summaryColor,
rightActions = {
Text(
modifier = Modifier.padding(end = 6.dp),
modifier = Modifier.widthIn(max = 130.dp),
text = items[selectedIndex],
fontSize = 15.sp,
fontSize = MiuixTheme.textStyles.body2.fontSize,
color = actionColor,
textAlign = TextAlign.End,
)
Image(
modifier = Modifier
.size(15.dp)
.padding(start = 8.dp)
.size(10.dp, 16.dp)
.align(Alignment.CenterVertically),
imageVector = MiuixIcons.ArrowUpDown,
imageVector = MiuixIcons.ArrowUpDownIntegrated,
colorFilter = BlendModeColorFilter(actionColor, BlendMode.SrcIn),
contentDescription = null
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,22 @@ import top.yukonga.miuix.kmp.icon.MiuixIcons
val MiuixIcons.ArrowRight: ImageVector
get() {
if (_arrowRight != null) return _arrowRight!!
_arrowRight = ImageVector.Builder("ArrowRight", 26.dp, 42.dp, 26f, 42f).apply {
_arrowRight = ImageVector.Builder("ArrowRight", 10.dp, 16.dp, 10f, 16f).apply {
path(
fill = SolidColor(Color.Black),
fillAlpha = 1f,
pathFillType = PathFillType.EvenOdd
) {
moveTo(18.9982f, 20.3635f)
lineTo(6.5388f, 7.9041f)
lineTo(4.4899f, 5.8552f)
curveTo(3.8367f, 5.202f, 3.8367f, 4.143f, 4.4899f, 3.4899f)
curveTo(5.143f, 2.8367f, 6.202f, 2.8367f, 6.8552f, 3.4899f)
lineTo(8.9041f, 5.5388f)
lineTo(21.3635f, 17.9982f)
lineTo(23.4124f, 20.0471f)
curveTo(23.7596f, 20.3943f, 23.9223f, 20.8562f, 23.9003f, 21.3109f)
curveTo(23.9238f, 21.7673f, 23.7612f, 22.2315f, 23.4126f, 22.5801f)
lineTo(21.3638f, 24.629f)
lineTo(8.9043f, 37.0884f)
lineTo(6.8555f, 39.1373f)
curveTo(6.2023f, 39.7904f, 5.1433f, 39.7904f, 4.4901f, 39.1373f)
curveTo(3.837f, 38.4841f, 3.837f, 37.4251f, 4.4901f, 36.772f)
lineTo(6.539f, 34.7231f)
lineTo(18.9984f, 22.2636f)
lineTo(19.9484f, 21.3137f)
lineTo(18.9982f, 20.3635f)
moveTo(1.65f, 1.469f)
curveTo(1.929f, 1.19f, 2.381f, 1.19f, 2.66f, 1.469f)
lineTo(8.721f, 7.53f)
curveTo(9.0f, 7.809f, 9.0f, 8.261f, 8.721f, 8.54f)
lineTo(2.66f, 14.601f)
curveTo(2.381f, 14.88f, 1.929f, 14.88f, 1.65f, 14.601f)
curveTo(1.371f, 14.322f, 1.371f, 13.87f, 1.65f, 13.591f)
lineTo(7.205f, 8.035f)
lineTo(1.65f, 2.479f)
curveTo(1.371f, 2.2f, 1.371f, 1.748f, 1.65f, 1.469f)
close()
}
}.build()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,50 +14,51 @@ import top.yukonga.miuix.kmp.icon.MiuixIcons
val MiuixIcons.ArrowUpDown: ImageVector
get() {
if (_arrowUpDown != null) return _arrowUpDown!!
_arrowUpDown = ImageVector.Builder("ArrowUpDown", 13.dp, 21.dp, 26f, 42f).apply {
_arrowUpDown = ImageVector.Builder("ArrowUpDown", 15.dp, 15.dp, 15f, 15f).apply {
path(
fill = SolidColor(Color.Black),
fillAlpha = 1f,
pathFillType = PathFillType.EvenOdd
) {
moveTo(5.8643f, 12.6223f)
lineTo(11.5708f, 6.9158f)
lineTo(12.7234f, 5.7632f)
lineTo(13.8245f, 6.8643f)
lineTo(19.531f, 12.5708f)
lineTo(21.9811f, 15.0208f)
curveTo(22.7621f, 15.8019f, 24.0284f, 15.8019f, 24.8095f, 15.0208f)
curveTo(25.5905f, 14.2398f, 25.5905f, 12.9734f, 24.8095f, 12.1924f)
lineTo(22.3595f, 9.7423f)
lineTo(16.6529f, 4.0358f)
lineTo(14.2029f, 1.5858f)
curveTo(13.6481f, 1.031f, 12.8484f, 0.8703f, 12.1517f, 1.1037f)
curveTo(11.8001f, 1.1854f, 11.4664f, 1.3633f, 11.1924f, 1.6373f)
lineTo(8.7424f, 4.0874f)
lineTo(3.0358f, 9.7939f)
lineTo(0.5858f, 12.2439f)
curveTo(-0.1953f, 13.025f, -0.1953f, 14.2913f, 0.5858f, 15.0724f)
curveTo(1.3668f, 15.8534f, 2.6332f, 15.8534f, 3.4142f, 15.0724f)
lineTo(5.8643f, 12.6223f)
moveTo(5.8643f, 29.7496f)
lineTo(11.5708f, 35.4562f)
lineTo(12.7234f, 36.6088f)
lineTo(13.8245f, 35.5077f)
lineTo(19.531f, 29.8012f)
lineTo(21.9811f, 27.3511f)
curveTo(22.7621f, 26.5701f, 24.0284f, 26.5701f, 24.8095f, 27.3511f)
curveTo(25.5905f, 28.1322f, 25.5905f, 29.3985f, 24.8095f, 30.1796f)
lineTo(22.3595f, 32.6296f)
lineTo(16.6529f, 38.3361f)
lineTo(14.2029f, 40.7862f)
curveTo(13.6481f, 41.341f, 12.8484f, 41.5017f, 12.1517f, 41.2683f)
curveTo(11.8001f, 41.1865f, 11.4664f, 41.0086f, 11.1924f, 40.7346f)
lineTo(8.7424f, 38.2846f)
lineTo(3.0358f, 32.5781f)
lineTo(0.5858f, 30.128f)
curveTo(-0.1953f, 29.347f, -0.1953f, 28.0806f, 0.5858f, 27.2996f)
curveTo(1.3668f, 26.5185f, 2.6332f, 26.5185f, 3.4142f, 27.2996f)
lineTo(5.8643f, 29.7496f)
moveTo(7.492f, 3.996f)
lineTo(5.629f, 5.86f)
lineTo(5.157f, 6.332f)
curveTo(4.874f, 6.615f, 4.414f, 6.615f, 4.131f, 6.332f)
curveTo(3.847f, 6.048f, 3.847f, 5.588f, 4.131f, 5.305f)
lineTo(4.603f, 4.833f)
lineTo(6.466f, 2.97f)
lineTo(6.938f, 2.498f)
curveTo(7.092f, 2.344f, 7.298f, 2.273f, 7.5f, 2.287f)
curveTo(7.701f, 2.274f, 7.907f, 2.344f, 8.061f, 2.498f)
lineTo(8.533f, 2.97f)
lineTo(10.396f, 4.833f)
lineTo(10.868f, 5.305f)
curveTo(11.152f, 5.589f, 11.152f, 6.048f, 10.868f, 6.332f)
curveTo(10.585f, 6.615f, 10.125f, 6.615f, 9.842f, 6.332f)
lineTo(9.37f, 5.86f)
lineTo(7.507f, 3.997f)
lineTo(7.499f, 3.989f)
lineTo(7.492f, 3.996f)
close()
moveTo(7.492f, 11.003f)
lineTo(5.629f, 9.14f)
lineTo(5.157f, 8.668f)
curveTo(4.874f, 8.385f, 4.414f, 8.385f, 4.131f, 8.668f)
curveTo(3.847f, 8.952f, 3.847f, 9.411f, 4.131f, 9.695f)
lineTo(4.603f, 10.167f)
lineTo(6.466f, 12.03f)
lineTo(6.938f, 12.502f)
curveTo(7.092f, 12.656f, 7.298f, 12.726f, 7.5f, 12.713f)
curveTo(7.701f, 12.726f, 7.907f, 12.656f, 8.061f, 12.502f)
lineTo(8.533f, 12.03f)
lineTo(10.396f, 10.167f)
lineTo(10.868f, 9.695f)
curveTo(11.152f, 9.411f, 11.152f, 8.952f, 10.868f, 8.668f)
curveTo(10.585f, 8.385f, 10.125f, 8.385f, 9.842f, 8.668f)
lineTo(9.37f, 9.14f)
lineTo(7.507f, 11.003f)
lineTo(7.499f, 11.01f)
lineTo(7.492f, 11.003f)
close()
}
}.build()
Expand Down
Loading