mirror of
https://github.com/BetterAndroid/FlexiUI.git
synced 2025-09-08 11:34:18 +08:00
fix: animation incoherent in PasswordTextField
This commit is contained in:
@@ -285,7 +285,6 @@ fun PasswordTextField(
|
|||||||
textStyle: TextStyle = TextField.textStyle
|
textStyle: TextStyle = TextField.textStyle
|
||||||
) {
|
) {
|
||||||
var passwordVisible by remember { mutableStateOf(defaultPasswordVisible) }
|
var passwordVisible by remember { mutableStateOf(defaultPasswordVisible) }
|
||||||
if (value.text.isEmpty()) passwordVisible = defaultPasswordVisible
|
|
||||||
TextField(
|
TextField(
|
||||||
value = value,
|
value = value,
|
||||||
onValueChange = onValueChange,
|
onValueChange = onValueChange,
|
||||||
@@ -313,6 +312,7 @@ fun PasswordTextField(
|
|||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
val animatedSize by animateDpAsState(if (value.text.isNotEmpty()) DefaultDecorIconSize else 0.dp)
|
val animatedSize by animateDpAsState(if (value.text.isNotEmpty()) DefaultDecorIconSize else 0.dp)
|
||||||
|
if (value.text.isEmpty() && animatedSize == 0.dp) passwordVisible = defaultPasswordVisible
|
||||||
IconToggleButton(
|
IconToggleButton(
|
||||||
modifier = Modifier.size(animatedSize).pointerHoverState(TextFieldPoinerState.NORMAL),
|
modifier = Modifier.size(animatedSize).pointerHoverState(TextFieldPoinerState.NORMAL),
|
||||||
style = IconButton.style.copy(padding = DefaultDecorIconPadding),
|
style = IconButton.style.copy(padding = DefaultDecorIconPadding),
|
||||||
|
Reference in New Issue
Block a user