diff --git a/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/CheckBox.kt b/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/CheckBox.kt index f2bc574..afc6a25 100644 --- a/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/CheckBox.kt +++ b/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/CheckBox.kt @@ -67,6 +67,7 @@ data class CheckBoxColors( @Immutable data class CheckBoxStyle( + val contentSpacing: Dp, val contentSize: Dp, val strokeSize: Dp, val pressedGain: Float, @@ -84,7 +85,6 @@ fun CheckBox( style: CheckBoxStyle = CheckBox.style, enabled: Boolean = true, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, - contentSpacing: Dp = CheckBox.contentSpacing, content: @Composable () -> Unit = {} ) { val hovered by interactionSource.collectIsHoveredAsState() @@ -121,7 +121,7 @@ fun CheckBox( ) } Box( - modifier = Modifier.padding(start = contentSpacing) + modifier = Modifier.padding(start = style.contentSpacing) .clickable(enabled = enabled) { onCheckedChange(!checked) } ) { content() } } @@ -136,10 +136,6 @@ object CheckBox { @Composable @ReadOnlyComposable get() = defaultCheckBoxStyle() - val contentSpacing: Dp - @Composable - @ReadOnlyComposable - get() = defaultCheckBoxContentSpacing() } @Composable @@ -153,6 +149,7 @@ private fun defaultCheckBoxColors() = CheckBoxColors( @Composable @ReadOnlyComposable private fun defaultCheckBoxStyle() = CheckBoxStyle( + contentSpacing = LocalSizes.current.spacingSecondary, contentSize = DefaultContentSize, strokeSize = DefaultStrokeSize, pressedGain = DefaultPressedGain, @@ -165,10 +162,6 @@ private fun defaultCheckBoxStyle() = CheckBoxStyle( @ReadOnlyComposable private fun defaultCheckBoxBorder() = BorderStroke(LocalSizes.current.borderSizeTertiary, LocalColors.current.textPrimary) -@Composable -@ReadOnlyComposable -private fun defaultCheckBoxContentSpacing() = LocalSizes.current.spacingSecondary - private val DefaultContentSize = 13.dp private val DefaultStrokeSize = 20.dp diff --git a/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/Switch.kt b/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/Switch.kt index e16e23f..32dbb2a 100644 --- a/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/Switch.kt +++ b/flexiui-core/src/commonMain/kotlin/com/highcapable/flexiui/component/Switch.kt @@ -75,6 +75,7 @@ data class SwitchColors( @Immutable data class SwitchStyle( val padding: Dp, + val contentSpacing: Dp, val thumbRadius: Dp, val thumbGain: Float, val thumbShadowSize: Dp, @@ -95,7 +96,6 @@ fun Switch( style: SwitchStyle = Switch.style, enabled: Boolean = true, interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, - contentSpacing: Dp = Switch.contentSpacing, content: @Composable () -> Unit = {} ) { val thumbDiameter = style.thumbRadius * 2 @@ -182,7 +182,7 @@ fun Switch( } Row(modifier = Modifier.status(enabled).then(modifier)) { Box( - modifier = Modifier.padding(end = contentSpacing) + modifier = Modifier.padding(end = style.contentSpacing) .clickable(enabled = enabled) { onCheckedChange(!checked) } ) { content() } Track { Thumb() } @@ -198,10 +198,6 @@ object Switch { @Composable @ReadOnlyComposable get() = defaultSwitchStyle() - val contentSpacing: Dp - @Composable - @ReadOnlyComposable - get() = defaultSwitchContentSpacing() } @Composable @@ -215,6 +211,7 @@ private fun defaultSwitchColors() = SwitchColors( @Composable @ReadOnlyComposable private fun defaultSwitchStyle() = SwitchStyle( + contentSpacing = LocalSizes.current.spacingSecondary, padding = DefaultSwitchPadding, thumbRadius = DefaultThumbRadius, thumbGain = DefaultThumbGain, @@ -231,10 +228,6 @@ private fun defaultSwitchStyle() = SwitchStyle( @ReadOnlyComposable private fun defaultSwitchBorder() = BorderStroke(LocalSizes.current.borderSizeTertiary, LocalColors.current.textPrimary) -@Composable -@ReadOnlyComposable -private fun defaultSwitchContentSpacing() = LocalSizes.current.spacingSecondary - private val DefaultSwitchPadding = 3.dp private val DefaultThumbRadius = 7.5.dp