fix: animation incoherent in PasswordTextField

This commit is contained in:
2023-11-19 06:05:03 +08:00
parent 98f062bf8c
commit 85032e8be0

View File

@@ -285,7 +285,6 @@ fun PasswordTextField(
textStyle: TextStyle = TextField.textStyle
) {
var passwordVisible by remember { mutableStateOf(defaultPasswordVisible) }
if (value.text.isEmpty()) passwordVisible = defaultPasswordVisible
TextField(
value = value,
onValueChange = onValueChange,
@@ -313,6 +312,7 @@ fun PasswordTextField(
contentAlignment = Alignment.Center
) {
val animatedSize by animateDpAsState(if (value.text.isNotEmpty()) DefaultDecorIconSize else 0.dp)
if (value.text.isEmpty() && animatedSize == 0.dp) passwordVisible = defaultPasswordVisible
IconToggleButton(
modifier = Modifier.size(animatedSize).pointerHoverState(TextFieldPoinerState.NORMAL),
style = IconButton.style.copy(padding = DefaultDecorIconPadding),