mirror of
https://github.com/BetterAndroid/FlexiUI.git
synced 2025-09-08 19:44:25 +08:00
feat: add inactive and active end icon tint in DropdownList
This commit is contained in:
@@ -113,7 +113,8 @@ import kotlin.math.min
|
|||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
data class DropdownListColors(
|
data class DropdownListColors(
|
||||||
val endIconTint: Color,
|
val endIconInactiveTint: Color,
|
||||||
|
val endIconActiveTint: Color,
|
||||||
val borderInactiveColor: Color,
|
val borderInactiveColor: Color,
|
||||||
val borderActiveColor: Color,
|
val borderActiveColor: Color,
|
||||||
val backgroundColor: Color
|
val backgroundColor: Color
|
||||||
@@ -169,6 +170,10 @@ fun DropdownList(
|
|||||||
var menuHeightPx by remember { mutableStateOf(0) }
|
var menuHeightPx by remember { mutableStateOf(0) }
|
||||||
val startPadding = style.startPadding.orElse() ?: style.padding
|
val startPadding = style.startPadding.orElse() ?: style.padding
|
||||||
val endPadding = style.endPadding.orElse() ?: style.padding
|
val endPadding = style.endPadding.orElse() ?: style.padding
|
||||||
|
val animatedEndIconTint by animateColorAsState(when {
|
||||||
|
focused || hovered -> colors.endIconActiveTint
|
||||||
|
else -> colors.endIconInactiveTint
|
||||||
|
})
|
||||||
val animatedBorderColor by animateColorAsState(when {
|
val animatedBorderColor by animateColorAsState(when {
|
||||||
focused || hovered -> style.borderActive.solidColor
|
focused || hovered -> style.borderActive.solidColor
|
||||||
else -> style.borderInactive.solidColor
|
else -> style.borderInactive.solidColor
|
||||||
@@ -208,7 +213,7 @@ fun DropdownList(
|
|||||||
rotationZ = animatedDirection
|
rotationZ = animatedDirection
|
||||||
}.size(style.endIconSize),
|
}.size(style.endIconSize),
|
||||||
imageVector = Icons.Dropdown,
|
imageVector = Icons.Dropdown,
|
||||||
tint = colors.endIconTint
|
tint = animatedEndIconTint
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
DropdownMenu(
|
DropdownMenu(
|
||||||
@@ -507,7 +512,8 @@ private val LocalDropdownMenuContentStyle = compositionLocalOf<AreaBoxStyle?> {
|
|||||||
@Composable
|
@Composable
|
||||||
@ReadOnlyComposable
|
@ReadOnlyComposable
|
||||||
private fun defaultDropdownListColors() = DropdownListColors(
|
private fun defaultDropdownListColors() = DropdownListColors(
|
||||||
endIconTint = LocalColors.current.themeSecondary,
|
endIconInactiveTint = LocalColors.current.themeSecondary,
|
||||||
|
endIconActiveTint = LocalColors.current.themePrimary,
|
||||||
borderInactiveColor = LocalColors.current.themeSecondary,
|
borderInactiveColor = LocalColors.current.themeSecondary,
|
||||||
borderActiveColor = LocalColors.current.themePrimary,
|
borderActiveColor = LocalColors.current.themePrimary,
|
||||||
backgroundColor = Color.Transparent
|
backgroundColor = Color.Transparent
|
||||||
|
Reference in New Issue
Block a user