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,
interactionSource = interactionSource,
then = modifier
).pointerHoverState(TextFieldPointerState.TEXT)
).pointerHoverState(TextFieldPointerState.Text)
) {
// 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.
@@ -364,7 +364,7 @@ fun PasswordTextField(
if (pressed) focusRequester.requestFocus()
if (value.text.isEmpty() && animatedSize == 0.dp) passwordVisible = defaultPasswordVisible
IconToggleButton(
modifier = Modifier.size(animatedSize).pointerHoverState(TextFieldPointerState.NORMAL),
modifier = Modifier.size(animatedSize).pointerHoverState(TextFieldPointerState.Common),
style = IconButton.style.copy(paddings = DefaultDecorIconPaddings),
checked = passwordVisible,
onCheckedChange = {
@@ -491,7 +491,7 @@ fun BackspaceTextField(
}
focusRequester.requestFocus()
},
modifier = Modifier.width(animatedSize).pointerHoverState(TextFieldPointerState.NORMAL),
modifier = Modifier.width(animatedSize).pointerHoverState(TextFieldPointerState.Common),
style = IconButton.style.copy(paddings = DefaultDecorIconPaddings),
enabled = enabled,
interactionSource = cInteractionSource
@@ -704,7 +704,7 @@ private fun TextFieldStyle(colors: TextFieldColors, content: @Composable () -> U
internal expect fun Modifier.pointerHoverState(state: TextFieldPointerState): Modifier
@Stable
internal enum class TextFieldPointerState { NORMAL, TEXT }
internal enum class TextFieldPointerState { Common, Text }
@Stable
private class TextFieldKeyEventFactory {

View File

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