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() {
|
Row() {
|
||||||
Text(text = "Next")
|
Text(text = "Next")
|
||||||
}
|
}
|
||||||
|
|
@ -122,7 +130,7 @@ fun serverDialog(serverURL: String, updateServerURL: (newServerURL: String) -> U
|
||||||
},
|
},
|
||||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Uri),
|
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Uri),
|
||||||
supportingText = {
|
supportingText = {
|
||||||
AnimatedVisibility(!isValidUrl(serverURL)) {
|
AnimatedVisibility(!isValidUrl(serverURL) && serverURL != "") {
|
||||||
Text(
|
Text(
|
||||||
text = "No valid URL",
|
text = "No valid URL",
|
||||||
color = MaterialTheme.colorScheme.error
|
color = MaterialTheme.colorScheme.error
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue