style: optimize enum named

This commit is contained in:
2023-11-26 10:59:59 +08:00
parent 3d22d550a5
commit 4128fa5505
2 changed files with 6 additions and 6 deletions

View File

@@ -186,7 +186,7 @@ fun TextField(
enabled = enabled, enabled = enabled,
interactionSource = interactionSource, interactionSource = interactionSource,
then = modifier then = modifier
).pointerHoverState(TextFieldPointerState.TEXT) ).pointerHoverState(TextFieldPointerState.Text)
) { ) {
// Note: If minWidth is not 0, a constant width is currently set. // Note: If minWidth is not 0, a constant width is currently set.
// At this time, the child layout must be completely filled into the parent layout. // At this time, the child layout must be completely filled into the parent layout.
@@ -364,7 +364,7 @@ fun PasswordTextField(
if (pressed) focusRequester.requestFocus() if (pressed) focusRequester.requestFocus()
if (value.text.isEmpty() && animatedSize == 0.dp) passwordVisible = defaultPasswordVisible if (value.text.isEmpty() && animatedSize == 0.dp) passwordVisible = defaultPasswordVisible
IconToggleButton( IconToggleButton(
modifier = Modifier.size(animatedSize).pointerHoverState(TextFieldPointerState.NORMAL), modifier = Modifier.size(animatedSize).pointerHoverState(TextFieldPointerState.Common),
style = IconButton.style.copy(paddings = DefaultDecorIconPaddings), style = IconButton.style.copy(paddings = DefaultDecorIconPaddings),
checked = passwordVisible, checked = passwordVisible,
onCheckedChange = { onCheckedChange = {
@@ -491,7 +491,7 @@ fun BackspaceTextField(
} }
focusRequester.requestFocus() focusRequester.requestFocus()
}, },
modifier = Modifier.width(animatedSize).pointerHoverState(TextFieldPointerState.NORMAL), modifier = Modifier.width(animatedSize).pointerHoverState(TextFieldPointerState.Common),
style = IconButton.style.copy(paddings = DefaultDecorIconPaddings), style = IconButton.style.copy(paddings = DefaultDecorIconPaddings),
enabled = enabled, enabled = enabled,
interactionSource = cInteractionSource interactionSource = cInteractionSource
@@ -704,7 +704,7 @@ private fun TextFieldStyle(colors: TextFieldColors, content: @Composable () -> U
internal expect fun Modifier.pointerHoverState(state: TextFieldPointerState): Modifier internal expect fun Modifier.pointerHoverState(state: TextFieldPointerState): Modifier
@Stable @Stable
internal enum class TextFieldPointerState { NORMAL, TEXT } internal enum class TextFieldPointerState { Common, Text }
@Stable @Stable
private class TextFieldKeyEventFactory { private class TextFieldKeyEventFactory {

View File

@@ -33,8 +33,8 @@ internal actual fun Modifier.pointerHoverState(state: TextFieldPointerState) = c
pointerHoverIcon( pointerHoverIcon(
PointerIcon( PointerIcon(
Cursor.getPredefinedCursor(when (state) { Cursor.getPredefinedCursor(when (state) {
TextFieldPointerState.NORMAL -> Cursor.DEFAULT_CURSOR TextFieldPointerState.Common -> Cursor.DEFAULT_CURSOR
TextFieldPointerState.TEXT -> Cursor.TEXT_CURSOR TextFieldPointerState.Text -> Cursor.TEXT_CURSOR
}) })
) )
) )