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
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -76,7 +79,7 @@ fun NavigationBar(
.background(Color.Transparent)
) {
HorizontalDivider(
thickness = 0.25.dp,
thickness = 0.75.dp,
color = MiuixTheme.colorScheme.dividerLine
)
Row(
Expand All @@ -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 = {
Expand All @@ -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
)
}
}
Expand All @@ -135,6 +141,10 @@ fun NavigationBar(
}
}

/** The default expanded height of a [NavigationBar]. */
val NavigationBarHeight: Dp = 64.dp


/**
* The data class for [NavigationBar].
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ fun SuperDropdown(
options = items,
isSelected = items[selectedIndex] == option,
onSelectedIndexChange = {
hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
onSelectedIndexChange(it)
dismissPopup()
isDropdownExpanded.value = false
Expand Down