Slide 56
Slide 56 text
A Composable for everything, and everything in its Composable
Solution: Handle value on the caller side and pass value as an argument
@Composable
private fun Password(
password: String,
onPasswordChange: (String) -> Unit,
modifier: Modifier = Modifier
) {
TextField(
modifier = modifier.fillMaxWidth(),
value = password,
onValueChange = onPasswordChange,
placeholder = { Text("Password") },
visualTransformation = PasswordVisualTransformation()
)
}
@Composable
private fun Email(
email: String,
onEmailChange: (String) -> Unit,
modifier: Modifier = Modifier
){
TextField(
modifier = modifier.fillMaxWidth(),
value = email,
onValueChange = onEmailChange,
placeholder = { Text("Email") },
singleLine = true
)
}