Created
June 5, 2021 15:41
-
-
Save hkawii/fc613c6803eb1bf1fe84fa28424827bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Box{ | |
TextField( | |
value = text, | |
onValueChange = { | |
text = it | |
if(!viewModel.isMapEditable.value) | |
viewModel.onTextChanged(context, text) | |
}, | |
modifier = Modifier.fillMaxWidth().padding(end = 80.dp), | |
enabled = !viewModel.isMapEditable.value, | |
colors = TextFieldDefaults.textFieldColors(backgroundColor = Color.Transparent) | |
) | |
Column( | |
modifier = Modifier.fillMaxWidth().padding(10.dp).padding(bottom = 20.dp), | |
horizontalAlignment = Alignment.End | |
){ | |
Button( | |
onClick = { | |
viewModel.isMapEditable.value = !viewModel.isMapEditable.value | |
} | |
) { | |
Text(text = if(viewModel.isMapEditable.value) "Edit" else "Save") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment