refactor: adjust the priority of Modifier in TextField

This commit is contained in:
2023-11-17 22:17:05 +08:00
parent 7a9cca2a3a
commit 7314256a64

View File

@@ -239,13 +239,14 @@ private fun TextFieldDecorationBox(
else -> style.borderInactive else -> style.borderInactive
}.copy(animatedBorderWidth, SolidColor(animatedBorderColor)) }.copy(animatedBorderWidth, SolidColor(animatedBorderColor))
Box( Box(
Modifier.textField( modifier = Modifier.textField(
colors = colors, colors = colors,
style = style, style = style,
border = border, border = border,
enabled = enabled, enabled = enabled,
interactionSource = interactionSource interactionSource = interactionSource,
).then(modifier) modifier = modifier
)
) { ) {
Row { Row {
header() header()
@@ -267,13 +268,15 @@ private fun Modifier.textField(
style: TextFieldStyle, style: TextFieldStyle,
border: BorderStroke, border: BorderStroke,
enabled: Boolean, enabled: Boolean,
interactionSource: MutableInteractionSource interactionSource: MutableInteractionSource,
modifier: Modifier
) = status(enabled) ) = status(enabled)
.focusable(enabled, interactionSource) .focusable(enabled, interactionSource)
.hoverable(interactionSource, enabled) .hoverable(interactionSource, enabled)
.clip(style.shape) .clip(style.shape)
.background(colors.backgroundColor, style.shape) .background(colors.backgroundColor, style.shape)
.borderOrNot(border, style.shape) .borderOrNot(border, style.shape)
.then(modifier)
.padding( .padding(
top = style.topPadding.orElse() ?: style.padding, top = style.topPadding.orElse() ?: style.padding,
start = style.startPadding.orElse() ?: style.padding, start = style.startPadding.orElse() ?: style.padding,