button enabled/disabled logic
This commit is contained in:
parent
e7086791c8
commit
078a1a9efe
1 changed files with 10 additions and 2 deletions
|
|
@ -71,7 +71,15 @@ fun homeScreen(paddingValues: PaddingValues) {
|
|||
}
|
||||
}
|
||||
|
||||
Button(onClick = {currentScreen = nextScreen}, modifier = Modifier.padding(top = 24.dp)) {
|
||||
Button(
|
||||
onClick = {currentScreen = nextScreen},
|
||||
modifier = Modifier.padding(top = 24.dp),
|
||||
enabled = when(currentScreen) {
|
||||
0 -> isValidUrl(serverURL)
|
||||
1 -> username.isNotEmpty() && password.isNotEmpty()
|
||||
else -> false
|
||||
},
|
||||
) {
|
||||
Row() {
|
||||
Text(text = "Next")
|
||||
}
|
||||
|
|
@ -122,7 +130,7 @@ fun serverDialog(serverURL: String, updateServerURL: (newServerURL: String) -> U
|
|||
},
|
||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Uri),
|
||||
supportingText = {
|
||||
AnimatedVisibility(!isValidUrl(serverURL)) {
|
||||
AnimatedVisibility(!isValidUrl(serverURL) && serverURL != "") {
|
||||
Text(
|
||||
text = "No valid URL",
|
||||
color = MaterialTheme.colorScheme.error
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue