I switched all the colors in the Color.kt
compose file to the ones I want. The problem is that the button I implmented is still purple. As you can see, its only the button which does not get the new Theme colors, but the text input fields are dark grey as intended.
This is the code:
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun LoginScreen(
nav: NavController
) {
val viewModel: LoginViewModel = viewModel()
HanniverReloadedTheme() {
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colors.background
) {
var usernameTextField by remember { mutableStateOf("") }
var passwordTextField by remember { mutableStateOf("") }
Column(
modifier = Modifier.fillMaxSize(),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(
modifier = Modifier.padding(bottom = 8.dp),
text = stringResource(id = R.string.app_name),
fontFamily = FontFamily.Monospace,
color = MaterialTheme.colors.primary,
style = MaterialTheme.typography.h5
)
TextField(
value = usernameTextField,
onValueChange = { usernameTextField = it },
label = { Text(stringResource(id = R.string.login_page_label_username)) },
)
TextField(
value = passwordTextField,
onValueChange = { passwordTextField = it },
label = { Text(stringResource(id = R.string.login_page_label_password)) },
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Password),
visualTransformation = PasswordVisualTransformation()
)
Button(
modifier = Modifier.padding(top = 8.dp),
onClick = { /*TODO*/ }
) {
Text(stringResource(id = R.string.login_page_button_login))
}
}
}
}
}
Also the Statusbar didnt change color and is still purple. So I tried to change the colors also in the colors.xml
file and changed also the themes.xml
so that it routes to the right color. It worked but I dont like the solution. Is there another approach for that or is this the way we do it so far?