mirror of
https://github.com/BetterAndroid/FlexiUI.git
synced 2025-09-08 11:34:18 +08:00
style: optimize enum named
This commit is contained in:
@@ -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 {
|
||||||
|
@@ -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
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user