AlertDialog
In Material 3 Compose
@Composable
fun OutlinedSecureTextFieldSample() {
var passwordHidden by remember { mutableStateOf(true) }
OutlinedSecureTextField(
state = rememberTextFieldState(),
label = { Text("Password") },
textObfuscationMode = if (passwordHidden) {
TextObfuscationMode.RevealLastTyped
} else {
TextObfuscationMode.Visible
},
trailingIcon = {
IconButton(onClick = { passwordHidden = !passwordHidden }) {
Icon(
imageVector = if (passwordHidden) {
Icons.Filled.Visibility
} else {
Icons.Filled.VisibilityOff
},
contentDescription = if (passwordHidden) "Show password" else "Hide password",
)
}
},
)
}