From 3c79ca548805a27a1d21a8031e799a84b69f15ea Mon Sep 17 00:00:00 2001 From: fankesyooni Date: Sat, 20 Jan 2024 16:52:05 +0800 Subject: [PATCH] refactor: use inner background color in AreaBox, ItemBox --- .../kotlin/com/highcapable/flexiui/component/AreaBox.kt | 6 +++++- .../kotlin/com/highcapable/flexiui/component/ItemBox.kt | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/AreaBox.kt b/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/AreaBox.kt index 637f2a5..b3356a5 100644 --- a/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/AreaBox.kt +++ b/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/AreaBox.kt @@ -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 diff --git a/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/ItemBox.kt b/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/ItemBox.kt index 4ad7b0e..49c3656 100644 --- a/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/ItemBox.kt +++ b/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/ItemBox.kt @@ -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