mirror of
https://github.com/BetterAndroid/FlexiUI.git
synced 2025-12-12 09:13:36 +08:00
refactor: replace size to diameter in RadioButton
This commit is contained in:
@@ -64,9 +64,9 @@ data class RadioButtonColors(
|
|||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
data class RadioButtonStyle(
|
data class RadioButtonStyle(
|
||||||
val contentSize: Dp,
|
val contentDiameter: Dp,
|
||||||
val contentShadowSize: Dp,
|
val contentShadowSize: Dp,
|
||||||
val strokeSize: Dp,
|
val strokeDiameter: Dp,
|
||||||
val pressedGain: Float,
|
val pressedGain: Float,
|
||||||
val hoveredGain: Float,
|
val hoveredGain: Float,
|
||||||
val shape: Shape,
|
val shape: Shape,
|
||||||
@@ -100,13 +100,13 @@ fun RadioButton(
|
|||||||
enabled = enabled,
|
enabled = enabled,
|
||||||
role = Role.RadioButton,
|
role = Role.RadioButton,
|
||||||
onClick = onClick
|
onClick = onClick
|
||||||
).size(style.strokeSize)
|
).size(style.strokeDiameter)
|
||||||
.scale(animatedStrokeScale)
|
.scale(animatedStrokeScale)
|
||||||
.background(animatedColor, style.shape),
|
.background(animatedColor, style.shape),
|
||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier.size(style.contentSize)
|
modifier = Modifier.size(style.contentDiameter)
|
||||||
.scale(animatedContentScale)
|
.scale(animatedContentScale)
|
||||||
.shadow(animatedContentShadow, style.shape)
|
.shadow(animatedContentShadow, style.shape)
|
||||||
.alpha(animatedContentAlpha)
|
.alpha(animatedContentAlpha)
|
||||||
@@ -146,9 +146,9 @@ private fun defaultRadioButtonColors() = RadioButtonColors(
|
|||||||
@Composable
|
@Composable
|
||||||
@ReadOnlyComposable
|
@ReadOnlyComposable
|
||||||
private fun defaultRadioButtonStyle() = RadioButtonStyle(
|
private fun defaultRadioButtonStyle() = RadioButtonStyle(
|
||||||
contentSize = DefaultContentSize,
|
contentDiameter = DefaultContentDiameter,
|
||||||
contentShadowSize = DefaultContentShadowSize,
|
contentShadowSize = DefaultContentShadowSize,
|
||||||
strokeSize = DefaultStrokeSize,
|
strokeDiameter = DefaultStrokeDiameter,
|
||||||
pressedGain = DefaultPressedGain,
|
pressedGain = DefaultPressedGain,
|
||||||
hoveredGain = DefaultHoveredGain,
|
hoveredGain = DefaultHoveredGain,
|
||||||
shape = CircleShape,
|
shape = CircleShape,
|
||||||
@@ -163,8 +163,8 @@ private fun defaultRadioButtonBorder() = BorderStroke(LocalSizes.current.borderS
|
|||||||
@ReadOnlyComposable
|
@ReadOnlyComposable
|
||||||
private fun defaultRadioButtonContentSpacing() = LocalSizes.current.spacingSecondary
|
private fun defaultRadioButtonContentSpacing() = LocalSizes.current.spacingSecondary
|
||||||
|
|
||||||
private val DefaultContentSize = 10.dp
|
private val DefaultContentDiameter = 10.dp
|
||||||
private val DefaultStrokeSize = 20.dp
|
private val DefaultStrokeDiameter = 20.dp
|
||||||
|
|
||||||
private const val DefaultPressedGain = 0.9f
|
private const val DefaultPressedGain = 0.9f
|
||||||
private const val DefaultHoveredGain = 1.2f
|
private const val DefaultHoveredGain = 1.2f
|
||||||
|
|||||||
Reference in New Issue
Block a user