refactor: update UI component states to use normal theme colors

This commit is contained in:
Kingkor Roy Tirtho 2026-07-10 11:49:03 +06:00
parent f6308d0f8b
commit 941b333a79
10 changed files with 263 additions and 34 deletions

View File

@ -125,12 +125,12 @@ private fun resolveTextFieldState(
) )
else -> ResolvedAutoCompleteTextFieldState( else -> ResolvedAutoCompleteTextFieldState(
theme.background.pressed, theme.background.normal,
theme.highlight.pressed, theme.highlight.normal,
theme.shape.pressed, theme.shape.normal,
theme.border.pressed, theme.border.normal,
theme.shadow.pressed, theme.shadow.normal,
theme.foreground.pressed theme.foreground.normal
) )
} }
} }

View File

@ -106,11 +106,11 @@ private fun resolveButtonState(
) )
else -> ResolvedButtonState( else -> ResolvedButtonState(
style.colors.focused, style.colors.normal,
style.shape.focused, style.shape.normal,
style.shadow.focused, style.shadow.normal,
style.border.focused, style.border.normal,
style.padding.focused style.padding.normal
) )
} }
} }
@ -311,21 +311,28 @@ fun GhostIconButton(
val outlineStyle = baseTheme.iconButtons.outline val outlineStyle = baseTheme.iconButtons.outline
val ghostStyle = theme ?: BaseUITheme.ButtonStyle( val ghostStyle = theme ?: BaseUITheme.ButtonStyle(
colors = BaseUITheme.InteractionState( colors = BaseUITheme.InteractionState(
normal = BaseUITheme.ButtonColors(
background = Brush.verticalGradient(listOf(Color.Transparent, Color.Transparent)),
foreground = outlineStyle.colors.normal.foreground,
highlight = outlineStyle.colors.normal.highlight,
),
hovered = outlineStyle.colors.hovered, hovered = outlineStyle.colors.hovered,
pressed = outlineStyle.colors.pressed, pressed = outlineStyle.colors.pressed,
focused = BaseUITheme.ButtonColors( focused = BaseUITheme.ButtonColors(
background = Brush.verticalGradient(listOf(Color.Transparent, Color.Transparent)), background = Brush.verticalGradient(listOf(Color.Transparent, Color.Transparent)),
foreground = outlineStyle.colors.focused.foreground, foreground = outlineStyle.colors.normal.foreground,
highlight = outlineStyle.colors.focused.highlight, highlight = outlineStyle.colors.normal.highlight,
), ),
), ),
shape = outlineStyle.shape, shape = outlineStyle.shape,
shadow = BaseUITheme.InteractionState( shadow = BaseUITheme.InteractionState(
normal = BaseUITheme.Shadow(0.dp, false, Color.Transparent, Color.Transparent),
hovered = outlineStyle.shadow.hovered, hovered = outlineStyle.shadow.hovered,
pressed = outlineStyle.shadow.pressed, pressed = outlineStyle.shadow.pressed,
focused = BaseUITheme.Shadow(0.dp, false, Color.Transparent, Color.Transparent), focused = BaseUITheme.Shadow(0.dp, false, Color.Transparent, Color.Transparent),
), ),
border = BaseUITheme.InteractionState( border = BaseUITheme.InteractionState(
normal = BaseUITheme.Border(Color.Transparent, 0.dp),
hovered = outlineStyle.border.hovered, hovered = outlineStyle.border.hovered,
pressed = outlineStyle.border.pressed, pressed = outlineStyle.border.pressed,
focused = BaseUITheme.Border(Color.Transparent, 0.dp), focused = BaseUITheme.Border(Color.Transparent, 0.dp),

View File

@ -85,7 +85,7 @@ private fun resolveCheckBoxState(
return when { return when {
isPressed -> ResolvedCheckBoxState(style.colors.pressed, style.shape.pressed, style.shadow.pressed, style.border.pressed) isPressed -> ResolvedCheckBoxState(style.colors.pressed, style.shape.pressed, style.shadow.pressed, style.border.pressed)
isHovered -> ResolvedCheckBoxState(style.colors.hovered, style.shape.hovered, style.shadow.hovered, style.border.hovered) isHovered -> ResolvedCheckBoxState(style.colors.hovered, style.shape.hovered, style.shadow.hovered, style.border.hovered)
else -> ResolvedCheckBoxState(style.colors.focused, style.shape.focused, style.shadow.focused, style.border.focused) else -> ResolvedCheckBoxState(style.colors.normal, style.shape.normal, style.shadow.normal, style.border.normal)
} }
} }

View File

@ -70,7 +70,7 @@ private fun resolveChipState(
return when { return when {
isPressed -> ResolvedChipState(style.colors.pressed, style.shape.pressed, style.shadow.pressed, style.border.pressed, style.padding.pressed) isPressed -> ResolvedChipState(style.colors.pressed, style.shape.pressed, style.shadow.pressed, style.border.pressed, style.padding.pressed)
isHovered -> ResolvedChipState(style.colors.hovered, style.shape.hovered, style.shadow.hovered, style.border.hovered, style.padding.hovered) isHovered -> ResolvedChipState(style.colors.hovered, style.shape.hovered, style.shadow.hovered, style.border.hovered, style.padding.hovered)
else -> ResolvedChipState(style.colors.focused, style.shape.focused, style.shadow.focused, style.border.focused, style.padding.focused) else -> ResolvedChipState(style.colors.normal, style.shape.normal, style.shadow.normal, style.border.normal, style.padding.normal)
} }
} }

View File

@ -95,22 +95,22 @@ fun Slider(
val stateColor = when { val stateColor = when {
isPressed -> sliderTheme.trackActiveColor.pressed isPressed -> sliderTheme.trackActiveColor.pressed
isHovered -> sliderTheme.trackActiveColor.hovered isHovered -> sliderTheme.trackActiveColor.hovered
else -> sliderTheme.trackActiveColor.focused else -> sliderTheme.trackActiveColor.normal
} }
val inactiveColor = when { val inactiveColor = when {
isPressed -> sliderTheme.trackInactiveColor.pressed isPressed -> sliderTheme.trackInactiveColor.pressed
isHovered -> sliderTheme.trackInactiveColor.hovered isHovered -> sliderTheme.trackInactiveColor.hovered
else -> sliderTheme.trackInactiveColor.focused else -> sliderTheme.trackInactiveColor.normal
} }
val thumbColor = when { val thumbColor = when {
isPressed -> sliderTheme.thumbColor.pressed isPressed -> sliderTheme.thumbColor.pressed
isHovered -> sliderTheme.thumbColor.hovered isHovered -> sliderTheme.thumbColor.hovered
else -> sliderTheme.thumbColor.focused else -> sliderTheme.thumbColor.normal
} }
val thumbShadowState = when { val thumbShadowState = when {
isPressed -> sliderTheme.thumbShadow.pressed isPressed -> sliderTheme.thumbShadow.pressed
isHovered -> sliderTheme.thumbShadow.hovered isHovered -> sliderTheme.thumbShadow.hovered
else -> sliderTheme.thumbShadow.focused else -> sliderTheme.thumbShadow.normal
} }
val trackActiveColor = if (enabled) stateColor else stateColor.copy(alpha = 0.38f) val trackActiveColor = if (enabled) stateColor else stateColor.copy(alpha = 0.38f)

View File

@ -81,7 +81,7 @@ private fun resolveTextFieldState(
return when { return when {
isFocused -> ResolvedTextFieldState(theme.background.focused, theme.highlight.focused, theme.shape.focused, theme.border.focused, theme.shadow.focused, theme.foreground.focused) isFocused -> ResolvedTextFieldState(theme.background.focused, theme.highlight.focused, theme.shape.focused, theme.border.focused, theme.shadow.focused, theme.foreground.focused)
isHovered -> ResolvedTextFieldState(theme.background.hovered, theme.highlight.hovered, theme.shape.hovered, theme.border.hovered, theme.shadow.hovered, theme.foreground.hovered) isHovered -> ResolvedTextFieldState(theme.background.hovered, theme.highlight.hovered, theme.shape.hovered, theme.border.hovered, theme.shadow.hovered, theme.foreground.hovered)
else -> ResolvedTextFieldState(theme.background.pressed, theme.highlight.pressed, theme.shape.pressed, theme.border.pressed, theme.shadow.pressed, theme.foreground.pressed) else -> ResolvedTextFieldState(theme.background.normal, theme.highlight.normal, theme.shape.normal, theme.border.normal, theme.shadow.normal, theme.foreground.normal)
} }
} }

View File

@ -54,19 +54,21 @@ data class BaseUITheme(
@Stable @Stable
data class InteractionState<T>( data class InteractionState<T>(
val normal: T,
val hovered: T, val hovered: T,
val pressed: T, val pressed: T,
val focused: T, val focused: T,
) { ) {
companion object { companion object {
fun <T> fromSingleValue(value: T): InteractionState<T> { fun <T> fromSingleValue(value: T): InteractionState<T> {
return InteractionState(value, value, value) return InteractionState(value, value, value, value)
} }
} }
} }
@Stable @Stable
data class AdvancedInteractionState<T>( data class AdvancedInteractionState<T>(
val normal: T,
val hovered: T, val hovered: T,
val pressed: T, val pressed: T,
val focused: T, val focused: T,
@ -75,7 +77,7 @@ data class BaseUITheme(
) { ) {
companion object { companion object {
fun <T> fromSingleValue(value: T): AdvancedInteractionState<T> { fun <T> fromSingleValue(value: T): AdvancedInteractionState<T> {
return AdvancedInteractionState(value, value, value, value, value) return AdvancedInteractionState(value, value, value, value, value, value)
} }
} }
} }
@ -200,23 +202,30 @@ fun rememberBaseUITheme(): BaseUITheme {
val defaultShape = RoundedCornerShape(14.dp) val defaultShape = RoundedCornerShape(14.dp)
val defaultShapeState = val defaultShapeState =
BaseUITheme.InteractionState<Shape>(defaultShape, defaultShape, defaultShape) BaseUITheme.InteractionState<Shape>(defaultShape, defaultShape, defaultShape, defaultShape)
val noBorder = BaseUITheme.Border(Color.Transparent, 0.dp) val noBorder = BaseUITheme.Border(Color.Transparent, 0.dp)
val noBorderState = BaseUITheme.InteractionState(noBorder, noBorder, noBorder) val noBorderState = BaseUITheme.InteractionState(noBorder, noBorder, noBorder, noBorder)
val noShadow = BaseUITheme.Shadow(0.dp, false, Color.Transparent, Color.Transparent) val noShadow = BaseUITheme.Shadow(0.dp, false, Color.Transparent, Color.Transparent)
val noShadowState = BaseUITheme.InteractionState(noShadow, noShadow, noShadow) val noShadowState = BaseUITheme.InteractionState(noShadow, noShadow, noShadow, noShadow)
val defaultButtonPadding = BaseUITheme.InteractionState( val defaultButtonPadding = BaseUITheme.InteractionState(
PaddingValues(horizontal = 20.dp, vertical = 10.dp), PaddingValues(horizontal = 20.dp, vertical = 10.dp),
PaddingValues(horizontal = 20.dp, vertical = 10.dp), PaddingValues(horizontal = 20.dp, vertical = 10.dp),
PaddingValues(horizontal = 20.dp, vertical = 10.dp), PaddingValues(horizontal = 20.dp, vertical = 10.dp),
PaddingValues(horizontal = 20.dp, vertical = 10.dp),
) )
val iconButtonPadding = BaseUITheme.InteractionState( val iconButtonPadding = BaseUITheme.InteractionState(
PaddingValues(8.dp), PaddingValues(8.dp),
PaddingValues(8.dp), PaddingValues(8.dp),
PaddingValues(8.dp), PaddingValues(8.dp),
PaddingValues(8.dp),
) )
val outlineColors = BaseUITheme.InteractionState( val outlineColors = BaseUITheme.InteractionState(
normal = BaseUITheme.ButtonColors(
background = Brush.verticalGradient(listOf(containerLighter, containerDarker)),
foreground = scheme.onSurface,
highlight = highlight,
),
hovered = BaseUITheme.ButtonColors( hovered = BaseUITheme.ButtonColors(
background = Brush.verticalGradient(listOf(containerLighter, containerDarker)), background = Brush.verticalGradient(listOf(containerLighter, containerDarker)),
foreground = scheme.onSurface, foreground = scheme.onSurface,
@ -234,6 +243,12 @@ fun rememberBaseUITheme(): BaseUITheme {
), ),
) )
val outlineShadow = BaseUITheme.InteractionState( val outlineShadow = BaseUITheme.InteractionState(
normal = BaseUITheme.Shadow(
6.dp,
true,
shadowColor.copy(alpha = 0.15f),
shadowColor.copy(alpha = 0.18f)
),
hovered = BaseUITheme.Shadow( hovered = BaseUITheme.Shadow(
9.dp, 9.dp,
true, true,
@ -254,12 +269,18 @@ fun rememberBaseUITheme(): BaseUITheme {
), ),
) )
val outlineBorder = BaseUITheme.InteractionState( val outlineBorder = BaseUITheme.InteractionState(
normal = BaseUITheme.Border(border, 0.5.dp),
hovered = BaseUITheme.Border(border, 0.5.dp), hovered = BaseUITheme.Border(border, 0.5.dp),
pressed = BaseUITheme.Border(border.copy(alpha = 0.7f), 0.5.dp), pressed = BaseUITheme.Border(border.copy(alpha = 0.7f), 0.5.dp),
focused = BaseUITheme.Border(border, 0.5.dp), focused = BaseUITheme.Border(border, 0.5.dp),
) )
val primaryColors = BaseUITheme.InteractionState( val primaryColors = BaseUITheme.InteractionState(
normal = BaseUITheme.ButtonColors(
background = Brush.verticalGradient(listOf(scheme.primary, scheme.primary)),
foreground = scheme.onPrimary,
highlight = Color.White.copy(alpha = 0.25f),
),
hovered = BaseUITheme.ButtonColors( hovered = BaseUITheme.ButtonColors(
background = Brush.verticalGradient(listOf(scheme.primary, scheme.primary)), background = Brush.verticalGradient(listOf(scheme.primary, scheme.primary)),
foreground = scheme.onPrimary, foreground = scheme.onPrimary,
@ -282,6 +303,12 @@ fun rememberBaseUITheme(): BaseUITheme {
), ),
) )
val primaryShadow = BaseUITheme.InteractionState( val primaryShadow = BaseUITheme.InteractionState(
normal = BaseUITheme.Shadow(
6.dp,
true,
scheme.primary.copy(alpha = 0.35f),
scheme.primary.copy(alpha = 0.4f)
),
hovered = BaseUITheme.Shadow( hovered = BaseUITheme.Shadow(
9.dp, 9.dp,
true, true,
@ -302,12 +329,23 @@ fun rememberBaseUITheme(): BaseUITheme {
), ),
) )
val primaryBorder = BaseUITheme.InteractionState( val primaryBorder = BaseUITheme.InteractionState(
normal = BaseUITheme.Border(scheme.primary, 0.5.dp),
hovered = BaseUITheme.Border(scheme.primary, 0.5.dp), hovered = BaseUITheme.Border(scheme.primary, 0.5.dp),
pressed = BaseUITheme.Border(scheme.primary, 0.5.dp), pressed = BaseUITheme.Border(scheme.primary, 0.5.dp),
focused = BaseUITheme.Border(scheme.primary, 0.5.dp), focused = BaseUITheme.Border(scheme.primary, 0.5.dp),
) )
val secondaryColors = BaseUITheme.InteractionState( val secondaryColors = BaseUITheme.InteractionState(
normal = BaseUITheme.ButtonColors(
background = Brush.verticalGradient(
listOf(
secondaryContainer,
secondaryContainer.copy(alpha = if (secondaryContainer.luminance() > 0.5f) 0.92f else 1f)
)
),
foreground = scheme.onSecondaryContainer,
highlight = secondaryHighlight,
),
hovered = BaseUITheme.ButtonColors( hovered = BaseUITheme.ButtonColors(
background = Brush.verticalGradient( background = Brush.verticalGradient(
listOf( listOf(
@ -340,6 +378,12 @@ fun rememberBaseUITheme(): BaseUITheme {
), ),
) )
val secondaryShadow = BaseUITheme.InteractionState( val secondaryShadow = BaseUITheme.InteractionState(
normal = BaseUITheme.Shadow(
6.dp,
true,
shadowColor.copy(alpha = 0.15f),
shadowColor.copy(alpha = 0.18f)
),
hovered = BaseUITheme.Shadow( hovered = BaseUITheme.Shadow(
9.dp, 9.dp,
true, true,
@ -360,12 +404,18 @@ fun rememberBaseUITheme(): BaseUITheme {
), ),
) )
val secondaryBorder = BaseUITheme.InteractionState( val secondaryBorder = BaseUITheme.InteractionState(
normal = BaseUITheme.Border(secondaryContainer.copy(alpha = 0.5f), 0.5.dp),
hovered = BaseUITheme.Border(secondaryContainer.copy(alpha = 0.5f), 0.5.dp), hovered = BaseUITheme.Border(secondaryContainer.copy(alpha = 0.5f), 0.5.dp),
pressed = BaseUITheme.Border(secondaryContainer.copy(alpha = 0.5f), 0.5.dp), pressed = BaseUITheme.Border(secondaryContainer.copy(alpha = 0.5f), 0.5.dp),
focused = BaseUITheme.Border(secondaryContainer.copy(alpha = 0.5f), 0.5.dp), focused = BaseUITheme.Border(secondaryContainer.copy(alpha = 0.5f), 0.5.dp),
) )
val ghostColors = BaseUITheme.InteractionState( val ghostColors = BaseUITheme.InteractionState(
normal = BaseUITheme.ButtonColors(
background = Brush.verticalGradient(listOf(Color.Transparent, Color.Transparent)),
foreground = scheme.onSurface,
highlight = Color.Transparent,
),
hovered = BaseUITheme.ButtonColors( hovered = BaseUITheme.ButtonColors(
background = Brush.verticalGradient( background = Brush.verticalGradient(
listOf( listOf(
@ -447,6 +497,7 @@ fun rememberBaseUITheme(): BaseUITheme {
) )
val textFieldForeground = BaseUITheme.InteractionState( val textFieldForeground = BaseUITheme.InteractionState(
normal = scheme.onSurface,
hovered = scheme.onSurface, hovered = scheme.onSurface,
pressed = scheme.onSurface, pressed = scheme.onSurface,
focused = scheme.onSurface, focused = scheme.onSurface,
@ -454,17 +505,18 @@ fun rememberBaseUITheme(): BaseUITheme {
val checkBoxShape = RoundedCornerShape(6.dp) val checkBoxShape = RoundedCornerShape(6.dp)
val checkBoxShapeState = val checkBoxShapeState =
BaseUITheme.InteractionState<Shape>(checkBoxShape, checkBoxShape, checkBoxShape) BaseUITheme.InteractionState<Shape>(checkBoxShape, checkBoxShape, checkBoxShape, checkBoxShape)
val noPadding = val noPadding =
BaseUITheme.InteractionState(PaddingValues(0.dp), PaddingValues(0.dp), PaddingValues(0.dp)) BaseUITheme.InteractionState(PaddingValues(0.dp), PaddingValues(0.dp), PaddingValues(0.dp), PaddingValues(0.dp))
val chipTabShape = RoundedCornerShape(10.dp) val chipTabShape = RoundedCornerShape(10.dp)
val chipTabShapeState = val chipTabShapeState =
BaseUITheme.InteractionState<Shape>(chipTabShape, chipTabShape, chipTabShape) BaseUITheme.InteractionState<Shape>(chipTabShape, chipTabShape, chipTabShape, chipTabShape)
val chipTabPadding = BaseUITheme.InteractionState( val chipTabPadding = BaseUITheme.InteractionState(
PaddingValues(horizontal = 14.dp, vertical = 4.dp), PaddingValues(horizontal = 14.dp, vertical = 4.dp),
PaddingValues(horizontal = 14.dp, vertical = 4.dp), PaddingValues(horizontal = 14.dp, vertical = 4.dp),
PaddingValues(horizontal = 14.dp, vertical = 4.dp), PaddingValues(horizontal = 14.dp, vertical = 4.dp),
PaddingValues(horizontal = 14.dp, vertical = 4.dp),
) )
return BaseUITheme( return BaseUITheme(
@ -482,26 +534,36 @@ fun rememberBaseUITheme(): BaseUITheme {
), ),
textField = TextFieldTheme( textField = TextFieldTheme(
background = BaseUITheme.InteractionState( background = BaseUITheme.InteractionState(
normal = Brush.verticalGradient(listOf(containerLighter, containerDarker)),
hovered = Brush.verticalGradient(listOf(containerLighter, containerDarker)), hovered = Brush.verticalGradient(listOf(containerLighter, containerDarker)),
pressed = Brush.verticalGradient(listOf(containerLighter, containerDarker)), pressed = Brush.verticalGradient(listOf(containerLighter, containerDarker)),
focused = Brush.verticalGradient(listOf(containerLighter, containerDarker)), focused = Brush.verticalGradient(listOf(containerLighter, containerDarker)),
), ),
highlight = BaseUITheme.InteractionState( highlight = BaseUITheme.InteractionState(
normal = highlight,
hovered = highlight, hovered = highlight,
pressed = highlight, pressed = highlight,
focused = highlight, focused = highlight,
), ),
shape = BaseUITheme.InteractionState( shape = BaseUITheme.InteractionState(
normal = defaultShape,
hovered = defaultShape, hovered = defaultShape,
pressed = defaultShape, pressed = defaultShape,
focused = defaultShape, focused = defaultShape,
), ),
border = BaseUITheme.InteractionState( border = BaseUITheme.InteractionState(
normal = BaseUITheme.Border(border.copy(alpha = 0.85f), 0.5.dp),
hovered = BaseUITheme.Border(border.copy(alpha = 0.85f), 0.5.dp), hovered = BaseUITheme.Border(border.copy(alpha = 0.85f), 0.5.dp),
pressed = BaseUITheme.Border(border, 0.5.dp), pressed = BaseUITheme.Border(border, 0.5.dp),
focused = BaseUITheme.Border(scheme.primary, 0.5.dp), focused = BaseUITheme.Border(scheme.primary, 0.5.dp),
), ),
shadow = BaseUITheme.InteractionState( shadow = BaseUITheme.InteractionState(
normal = BaseUITheme.Shadow(
9.dp,
true,
shadowColor.copy(alpha = 0.22f),
shadowColor.copy(alpha = 0.26f)
),
hovered = BaseUITheme.Shadow( hovered = BaseUITheme.Shadow(
9.dp, 9.dp,
true, true,
@ -540,21 +602,30 @@ fun rememberBaseUITheme(): BaseUITheme {
), ),
slider = SliderTheme( slider = SliderTheme(
trackActiveColor = BaseUITheme.InteractionState( trackActiveColor = BaseUITheme.InteractionState(
normal = scheme.primary,
hovered = scheme.primary, hovered = scheme.primary,
pressed = scheme.primary, pressed = scheme.primary,
focused = scheme.primary, focused = scheme.primary,
), ),
trackInactiveColor = BaseUITheme.InteractionState( trackInactiveColor = BaseUITheme.InteractionState(
normal = border.copy(alpha = 0.6f),
hovered = border.copy(alpha = 0.6f), hovered = border.copy(alpha = 0.6f),
pressed = border.copy(alpha = 0.6f), pressed = border.copy(alpha = 0.6f),
focused = border.copy(alpha = 0.6f), focused = border.copy(alpha = 0.6f),
), ),
thumbColor = BaseUITheme.InteractionState( thumbColor = BaseUITheme.InteractionState(
normal = scheme.primary,
hovered = scheme.primary, hovered = scheme.primary,
pressed = scheme.primary, pressed = scheme.primary,
focused = scheme.primary, focused = scheme.primary,
), ),
thumbShadow = BaseUITheme.InteractionState( thumbShadow = BaseUITheme.InteractionState(
normal = BaseUITheme.Shadow(
5.dp,
true,
scheme.primary.copy(alpha = 0.35f),
scheme.primary.copy(alpha = 0.4f)
),
hovered = BaseUITheme.Shadow( hovered = BaseUITheme.Shadow(
8.dp, 8.dp,
true, true,
@ -582,6 +653,12 @@ fun rememberBaseUITheme(): BaseUITheme {
colors = primaryColors, colors = primaryColors,
shape = checkBoxShapeState, shape = checkBoxShapeState,
shadow = BaseUITheme.InteractionState( shadow = BaseUITheme.InteractionState(
normal = BaseUITheme.Shadow(
6.dp,
true,
scheme.primary.copy(alpha = 0.3f),
scheme.primary.copy(alpha = 0.35f)
),
hovered = BaseUITheme.Shadow( hovered = BaseUITheme.Shadow(
8.dp, 8.dp,
true, true,
@ -608,6 +685,12 @@ fun rememberBaseUITheme(): BaseUITheme {
colors = outlineColors, colors = outlineColors,
shape = checkBoxShapeState, shape = checkBoxShapeState,
shadow = BaseUITheme.InteractionState( shadow = BaseUITheme.InteractionState(
normal = BaseUITheme.Shadow(
3.dp,
true,
shadowColor.copy(alpha = 0.15f),
shadowColor.copy(alpha = 0.18f)
),
hovered = BaseUITheme.Shadow( hovered = BaseUITheme.Shadow(
5.dp, 5.dp,
true, true,
@ -662,6 +745,7 @@ fun rememberBaseUITheme(): BaseUITheme {
), ),
listRowTile = BaseUITheme.ListRowTheme( listRowTile = BaseUITheme.ListRowTheme(
background = BaseUITheme.AdvancedInteractionState( background = BaseUITheme.AdvancedInteractionState(
normal = Brush.verticalGradient(listOf(Color.Transparent, Color.Transparent)),
hovered = Brush.verticalGradient(listOf(containerLighter, containerDarker)), hovered = Brush.verticalGradient(listOf(containerLighter, containerDarker)),
pressed = Brush.verticalGradient(listOf(containerPressed, containerPressed)), pressed = Brush.verticalGradient(listOf(containerPressed, containerPressed)),
focused = Brush.verticalGradient(listOf(containerLighter, containerDarker)), focused = Brush.verticalGradient(listOf(containerLighter, containerDarker)),
@ -679,6 +763,7 @@ fun rememberBaseUITheme(): BaseUITheme {
), ),
), ),
shape = BaseUITheme.AdvancedInteractionState( shape = BaseUITheme.AdvancedInteractionState(
normal = RoundedCornerShape(8.dp),
hovered = RoundedCornerShape(8.dp), hovered = RoundedCornerShape(8.dp),
pressed = RoundedCornerShape(8.dp), pressed = RoundedCornerShape(8.dp),
focused = RoundedCornerShape(8.dp), focused = RoundedCornerShape(8.dp),
@ -686,6 +771,7 @@ fun rememberBaseUITheme(): BaseUITheme {
disabled = RoundedCornerShape(8.dp), disabled = RoundedCornerShape(8.dp),
), ),
border = BaseUITheme.AdvancedInteractionState( border = BaseUITheme.AdvancedInteractionState(
normal = BaseUITheme.Border(Color.Transparent, 0.dp),
hovered = BaseUITheme.Border(Color.Transparent, 0.dp), hovered = BaseUITheme.Border(Color.Transparent, 0.dp),
pressed = BaseUITheme.Border(Color.Transparent, 0.dp), pressed = BaseUITheme.Border(Color.Transparent, 0.dp),
focused = BaseUITheme.Border(Color.Transparent, 0.dp), focused = BaseUITheme.Border(Color.Transparent, 0.dp),
@ -693,6 +779,7 @@ fun rememberBaseUITheme(): BaseUITheme {
disabled = BaseUITheme.Border(Color.Transparent, 0.dp), disabled = BaseUITheme.Border(Color.Transparent, 0.dp),
), ),
shadow = BaseUITheme.AdvancedInteractionState( shadow = BaseUITheme.AdvancedInteractionState(
normal = BaseUITheme.Shadow(0.dp, false, Color.Transparent, Color.Transparent),
hovered = BaseUITheme.Shadow(0.dp, false, Color.Transparent, Color.Transparent), hovered = BaseUITheme.Shadow(0.dp, false, Color.Transparent, Color.Transparent),
pressed = BaseUITheme.Shadow(0.dp, false, Color.Transparent, Color.Transparent), pressed = BaseUITheme.Shadow(0.dp, false, Color.Transparent, Color.Transparent),
focused = BaseUITheme.Shadow(0.dp, false, Color.Transparent, Color.Transparent), focused = BaseUITheme.Shadow(0.dp, false, Color.Transparent, Color.Transparent),
@ -701,6 +788,7 @@ fun rememberBaseUITheme(): BaseUITheme {
), ),
padding = PaddingValues(horizontal = 8.dp, vertical = 6.dp), padding = PaddingValues(horizontal = 8.dp, vertical = 6.dp),
textStyle = BaseUITheme.AdvancedInteractionState( textStyle = BaseUITheme.AdvancedInteractionState(
normal = TextStyle.Default,
hovered = TextStyle.Default, hovered = TextStyle.Default,
pressed = TextStyle.Default, pressed = TextStyle.Default,
focused = TextStyle.Default, focused = TextStyle.Default,
@ -708,6 +796,7 @@ fun rememberBaseUITheme(): BaseUITheme {
disabled = TextStyle.Default, disabled = TextStyle.Default,
), ),
foreground = BaseUITheme.AdvancedInteractionState( foreground = BaseUITheme.AdvancedInteractionState(
normal = scheme.onSurface,
hovered = scheme.onSurface, hovered = scheme.onSurface,
pressed = scheme.onSurface, pressed = scheme.onSurface,
focused = scheme.onSurface, focused = scheme.onSurface,
@ -766,6 +855,7 @@ fun invertedButtonStyle(): BaseUITheme.ButtonStyle {
return BaseUITheme.ButtonStyle( return BaseUITheme.ButtonStyle(
colors = BaseUITheme.InteractionState( colors = BaseUITheme.InteractionState(
normal = invertedColors,
hovered = invertedColors, hovered = invertedColors,
pressed = pressedColors, pressed = pressedColors,
focused = invertedColors, focused = invertedColors,

View File

@ -562,7 +562,7 @@ private fun TrackListRow(
isSelected -> rowTheme.background.selected isSelected -> rowTheme.background.selected
isCurrentTrack && isCurrentTrackPlaying -> rowTheme.background.hovered isCurrentTrack && isCurrentTrackPlaying -> rowTheme.background.hovered
isCurrentTrack -> rowTheme.background.focused isCurrentTrack -> rowTheme.background.focused
else -> Brush.verticalGradient(listOf(Color.Transparent, Color.Transparent)) else -> rowTheme.background.normal
} }
val highlightColor = Color.White.copy( val highlightColor = Color.White.copy(
alpha = if (isLight) 0.9f else 0.06f alpha = if (isLight) 0.9f else 0.06f

View File

@ -53,12 +53,11 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import coil3.compose.AsyncImage import coil3.compose.AsyncImage
import compose.icons.FeatherIcons
import compose.icons.feathericons.MoreVertical
import dev.krtirtho.spotube.core.audioplayer.QueueEntry import dev.krtirtho.spotube.core.audioplayer.QueueEntry
import dev.krtirtho.spotube.core.di.rememberLogger import dev.krtirtho.spotube.core.di.rememberLogger
import dev.krtirtho.spotube.core.ui.base.GhostIconButton import dev.krtirtho.spotube.core.ui.base.GhostIconButton
@ -66,9 +65,13 @@ import dev.krtirtho.spotube.core.ui.base.LocalBaseUITheme
import dev.krtirtho.spotube.core.ui.base.SecondaryIconButton import dev.krtirtho.spotube.core.ui.base.SecondaryIconButton
import dev.krtirtho.spotube.core.ui.base.TextField import dev.krtirtho.spotube.core.ui.base.TextField
import dev.krtirtho.spotube.core.ui.base.copyShape import dev.krtirtho.spotube.core.ui.base.copyShape
import dev.krtirtho.spotube.core.ui.base.highlight
import dev.krtirtho.spotube.resources.iconsax.Iconsax import dev.krtirtho.spotube.resources.iconsax.Iconsax
import dev.krtirtho.spotube.resources.iconsax.Iconsax3DotsMore
import dev.krtirtho.spotube.resources.iconsax.IconsaxDragHandle
import dev.krtirtho.spotube.resources.iconsax.IconsaxFilterSearch import dev.krtirtho.spotube.resources.iconsax.IconsaxFilterSearch
import dev.krtirtho.spotube.resources.iconsax.IconsaxMusicSquareRemove import dev.krtirtho.spotube.resources.iconsax.IconsaxMusicSquareRemove
import dev.krtirtho.spotube.resources.iconsax.IconsaxSetting
import dev.krtirtho.spotube.resources.iconsax.IconsaxTrash import dev.krtirtho.spotube.resources.iconsax.IconsaxTrash
import org.koin.compose.viewmodel.koinViewModel import org.koin.compose.viewmodel.koinViewModel
import sh.calvin.reorderable.ReorderableItem import sh.calvin.reorderable.ReorderableItem
@ -127,7 +130,7 @@ fun PlayerQueueContent(
val filtered = if (isFiltered) { val filtered = if (isFiltered) {
sourceItems.filter { item -> sourceItems.filter { item ->
item.title.lowercase().contains(normalizedFilter) || item.title.lowercase().contains(normalizedFilter) ||
item.subtitle.lowercase().contains(normalizedFilter) item.subtitle.lowercase().contains(normalizedFilter)
} }
} else { } else {
sourceItems sourceItems
@ -251,6 +254,7 @@ private fun QueueItemRow(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.clip(MaterialTheme.shapes.medium) .clip(MaterialTheme.shapes.medium)
.highlight(LocalBaseUITheme.current.buttons.secondary.colors.normal.highlight)
.clickable(onClick = onPlayClick), .clickable(onClick = onPlayClick),
shadowElevation = elevation, shadowElevation = elevation,
tonalElevation = if (item.isCurrent) 2.dp else 0.dp, tonalElevation = if (item.isCurrent) 2.dp else 0.dp,
@ -264,7 +268,7 @@ private fun QueueItemRow(
verticalAlignment = Alignment.CenterVertically, verticalAlignment = Alignment.CenterVertically,
) { ) {
Icon( Icon(
FeatherIcons.MoreVertical, Iconsax.IconsaxDragHandle,
contentDescription = if (reorderScope != null) "Reorder" else null, contentDescription = if (reorderScope != null) "Reorder" else null,
modifier = Modifier modifier = Modifier
.size(24.dp) .size(24.dp)
@ -340,7 +344,7 @@ private fun QueueItemRow(
modifier = Modifier.size(36.dp), modifier = Modifier.size(36.dp),
) { ) {
Icon( Icon(
FeatherIcons.MoreVertical, Iconsax.Iconsax3DotsMore,
contentDescription = "More options", contentDescription = "More options",
modifier = Modifier.size(18.dp), modifier = Modifier.size(18.dp),
) )

View File

@ -0,0 +1,128 @@
/*
* Copyright (C) 2026 Kingkor Roy Tirtho and Spotube Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package dev.krtirtho.spotube.resources.iconsax
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.PathData
import androidx.compose.ui.graphics.vector.group
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
val Iconsax.IconsaxDragHandle: ImageVector
get() {
if (_IconsaxDragHandle != null) {
return _IconsaxDragHandle!!
}
_IconsaxDragHandle = ImageVector.Builder(
name = "IconsaxDragHandle",
defaultWidth = 24.dp,
defaultHeight = 24.dp,
viewportWidth = 24f,
viewportHeight = 24f
).apply {
group(
clipPathData = PathData {
moveTo(0f, 0f)
horizontalLineToRelative(24f)
verticalLineToRelative(24f)
horizontalLineToRelative(-24f)
close()
}
) {
path(
fill = SolidColor(Color.White),
fillAlpha = 0.4f,
strokeAlpha = 0.4f
) {
moveTo(8f, 4f)
curveTo(6.9f, 4f, 6f, 4.9f, 6f, 6f)
curveTo(6f, 7.1f, 6.9f, 8f, 8f, 8f)
curveTo(9.1f, 8f, 10f, 7.1f, 10f, 6f)
curveTo(10f, 4.9f, 9.1f, 4f, 8f, 4f)
close()
}
path(
fill = SolidColor(Color.White),
fillAlpha = 0.4f,
strokeAlpha = 0.4f
) {
moveTo(16f, 4f)
curveTo(14.9f, 4f, 14f, 4.9f, 14f, 6f)
curveTo(14f, 7.1f, 14.9f, 8f, 16f, 8f)
curveTo(17.1f, 8f, 18f, 7.1f, 18f, 6f)
curveTo(18f, 4.9f, 17.1f, 4f, 16f, 4f)
close()
}
path(
fill = SolidColor(Color.White),
fillAlpha = 0.4f,
strokeAlpha = 0.4f
) {
moveTo(8f, 10f)
curveTo(6.9f, 10f, 6f, 10.9f, 6f, 12f)
curveTo(6f, 13.1f, 6.9f, 14f, 8f, 14f)
curveTo(9.1f, 14f, 10f, 13.1f, 10f, 12f)
curveTo(10f, 10.9f, 9.1f, 10f, 8f, 10f)
close()
}
path(
fill = SolidColor(Color.White),
fillAlpha = 0.4f,
strokeAlpha = 0.4f
) {
moveTo(16f, 10f)
curveTo(14.9f, 10f, 14f, 10.9f, 14f, 12f)
curveTo(14f, 13.1f, 14.9f, 14f, 16f, 14f)
curveTo(17.1f, 14f, 18f, 13.1f, 18f, 12f)
curveTo(18f, 10.9f, 17.1f, 10f, 16f, 10f)
close()
}
path(
fill = SolidColor(Color.White),
fillAlpha = 0.4f,
strokeAlpha = 0.4f
) {
moveTo(8f, 16f)
curveTo(6.9f, 16f, 6f, 16.9f, 6f, 18f)
curveTo(6f, 19.1f, 6.9f, 20f, 8f, 20f)
curveTo(9.1f, 20f, 10f, 19.1f, 10f, 18f)
curveTo(10f, 16.9f, 9.1f, 16f, 8f, 16f)
close()
}
path(
fill = SolidColor(Color.White),
fillAlpha = 0.4f,
strokeAlpha = 0.4f
) {
moveTo(16f, 16f)
curveTo(14.9f, 16f, 14f, 16.9f, 14f, 18f)
curveTo(14f, 19.1f, 14.9f, 20f, 16f, 20f)
curveTo(17.1f, 20f, 18f, 19.1f, 18f, 18f)
curveTo(18f, 16.9f, 17.1f, 16f, 16f, 16f)
close()
}
}
}.build()
return _IconsaxDragHandle!!
}
@Suppress("ObjectPropertyName")
private var _IconsaxDragHandle: ImageVector? = null