diff --git a/miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/Button.kt b/miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/Button.kt index 4f8f851b..eac2ad77 100644 --- a/miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/Button.kt +++ b/miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/Button.kt @@ -80,7 +80,7 @@ fun Button( @Composable private fun getButtonColor(enabled: Boolean, submit: Boolean): Color { return if (enabled) { - if (submit) MiuixTheme.colorScheme.primary else MiuixTheme.colorScheme.secondary + if (submit) MiuixTheme.colorScheme.primary else MiuixTheme.colorScheme.secondaryVariant } else { if (submit) MiuixTheme.colorScheme.disabledPrimaryButton else MiuixTheme.colorScheme.disabledSecondaryVariant } @@ -89,7 +89,7 @@ private fun getButtonColor(enabled: Boolean, submit: Boolean): Color { @Composable private fun getTextColor(enabled: Boolean, submit: Boolean): Color { return if (enabled) { - if (submit) Color.White else MiuixTheme.colorScheme.onBackground + if (submit) MiuixTheme.colorScheme.onPrimary else MiuixTheme.colorScheme.onSecondaryVariant } else { if (submit) MiuixTheme.colorScheme.disabledOnPrimaryButton else MiuixTheme.colorScheme.disabledOnSecondaryVariant } diff --git a/miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/Checkbox.kt b/miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/Checkbox.kt index a889606c..8c28e1a6 100644 --- a/miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/Checkbox.kt +++ b/miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/Checkbox.kt @@ -57,7 +57,7 @@ fun Checkbox( var isPressed by remember { mutableStateOf(false) } val backgroundColor by animateColorAsState(if (isChecked) MiuixTheme.colorScheme.primary else MiuixTheme.colorScheme.secondary) val disabledBackgroundColor by rememberUpdatedState(if (isChecked) MiuixTheme.colorScheme.disabledPrimary else MiuixTheme.colorScheme.disabledSecondary) - val checkboxSize by animateDpAsState(if (isPressed) 20.dp else 22.dp) + val checkboxSize by animateDpAsState(if (!enabled) 22.dp else if (isPressed) 20.dp else 22.dp) val checkmarkColor by animateColorAsState(if (checked) MiuixTheme.colorScheme.onPrimary else backgroundColor) val disabledCheckmarkColor by animateColorAsState(if (checked) MiuixTheme.colorScheme.disabledOnPrimary else disabledBackgroundColor) val rotationAngle by animateFloatAsState( diff --git a/miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/NavigationBar.kt b/miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/NavigationBar.kt index 422cdb23..74327ed8 100644 --- a/miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/NavigationBar.kt +++ b/miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/NavigationBar.kt @@ -14,6 +14,7 @@ import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.asPaddingValues import androidx.compose.foundation.layout.captionBar import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.navigationBarsPadding import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.padding @@ -31,7 +32,9 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.ColorFilter import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.input.pointer.pointerInput +import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import top.yukonga.miuix.kmp.theme.MiuixTheme @@ -76,7 +79,7 @@ fun NavigationBar( .background(Color.Transparent) ) { HorizontalDivider( - thickness = 0.25.dp, + thickness = 0.75.dp, color = MiuixTheme.colorScheme.dividerLine ) Row( @@ -100,10 +103,12 @@ fun NavigationBar( else -> MiuixTheme.colorScheme.onSurfaceContainerVariant } ) + val fontWeight = if (isSelected) FontWeight.Medium else FontWeight.Normal Column( horizontalAlignment = Alignment.CenterHorizontally, modifier = Modifier .weight(1f / items.size) + .height(NavigationBarHeight) .pointerInput(Unit) { detectTapGestures( onPress = { @@ -122,11 +127,12 @@ fun NavigationBar( colorFilter = ColorFilter.tint(tint) ) Text( - modifier = Modifier.padding(bottom = 14.dp), + modifier = Modifier.padding(bottom = 12.dp), text = item.label, color = tint, textAlign = TextAlign.Center, - fontSize = 13.sp, + fontSize = 12.sp, + fontWeight = fontWeight ) } } @@ -135,6 +141,10 @@ fun NavigationBar( } } +/** The default expanded height of a [NavigationBar]. */ +val NavigationBarHeight: Dp = 64.dp + + /** * The data class for [NavigationBar]. * diff --git a/miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/Switch.kt b/miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/Switch.kt index e4e7a52f..1e167ef3 100644 --- a/miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/Switch.kt +++ b/miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/Switch.kt @@ -65,15 +65,15 @@ fun Switch( var dragOffset by remember { mutableStateOf(0f) } val thumbOffset by animateDpAsState( targetValue = if (isChecked) { - if (isPressed) 26.5.dp else 28.dp + if (!enabled) 28.dp else if (isPressed) 26.5.dp else 28.dp } else { - if (isPressed) 2.5.dp else 4.dp + if (!enabled) 4.dp else if (isPressed) 2.5.dp else 4.dp } + dragOffset.dp, animationSpec = springSpec ) val thumbSize by animateDpAsState( - targetValue = if (isPressed) 23.dp else 20.dp, + targetValue = if (!enabled) 20.dp else if (isPressed) 23.dp else 20.dp, animationSpec = springSpec ) diff --git a/miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/TopAppBar.kt b/miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/TopAppBar.kt index 08ca8529..325b4a49 100644 --- a/miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/TopAppBar.kt +++ b/miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/basic/TopAppBar.kt @@ -546,7 +546,7 @@ private fun TopAppBarLayout( }, modifier = Modifier .windowInsetsPadding(WindowInsets.statusBars) - .heightIn(max = 60.dp + TopAppBarExpandedHeight) + .heightIn(max = 56.dp + TopAppBarExpandedHeight) .clipToBounds() ) { measurables, constraints -> val navigationIconPlaceable = diff --git a/miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/extra/SuperDropdown.kt b/miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/extra/SuperDropdown.kt index 71c42226..775e96e8 100644 --- a/miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/extra/SuperDropdown.kt +++ b/miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/extra/SuperDropdown.kt @@ -235,6 +235,7 @@ fun SuperDropdown( options = items, isSelected = items[selectedIndex] == option, onSelectedIndexChange = { + hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress) onSelectedIndexChange(it) dismissPopup() isDropdownExpanded.value = false