refactor: use inner background color in AreaBox, ItemBox

This commit is contained in:
2024-01-20 16:52:05 +08:00
parent 034d5d1100
commit 3c79ca5488
2 changed files with 6 additions and 3 deletions

View File

@@ -218,7 +218,10 @@ object AreaBoxDefaults {
*/
@Composable
fun colors(
backgroundColor: Color = AreaBoxProperties.BackgroundColor.toColor(),
backgroundColor: Color = when (LocalInAreaBox.current) {
true -> AreaBoxProperties.InnerBackgroundColor
else -> AreaBoxProperties.BackgroundColor
}.toColor(),
borderColor: Color = AreaBoxProperties.BorderColor.toColor()
) = AreaBoxColors(
backgroundColor = backgroundColor,
@@ -268,6 +271,7 @@ object AreaBoxDefaults {
@Stable
internal object AreaBoxProperties {
val BackgroundColor = ColorsDescriptor.ForegroundPrimary
val InnerBackgroundColor = ColorsDescriptor.ForegroundSecondary
val BorderColor = ColorsDescriptor.TextPrimary
val Padding = PaddingDescriptor(SizesDescriptor.SpacingPrimary)
val Shape = ShapesDescriptor.Primary

View File

@@ -247,7 +247,7 @@ object ItemBoxDefaults {
*/
@Composable
fun colors(
backgroundColor: Color = ItemBoxProperties.BackgroundColor.toColor(),
backgroundColor: Color = AreaBoxDefaults.colors().backgroundColor,
titleTextColor: Color = ItemBoxProperties.TitleTextColor.toColor(),
subtitleTextColor: Color = ItemBoxProperties.SubtitleTextColor.toColor(),
arrowIconTint: Color = ItemBoxProperties.ArrowIconTint.toColor(),
@@ -290,7 +290,6 @@ object ItemBoxDefaults {
@Stable
internal object ItemBoxProperties {
val BackgroundColor = AreaBoxProperties.BackgroundColor
val TitleTextColor = ColorsDescriptor.TextPrimary
val SubtitleTextColor = ColorsDescriptor.TextSecondary
val ArrowIconTint = ColorsDescriptor.TextSecondary