Skip to content

Instantly share code, notes, and snippets.

@hkawii
Created June 5, 2021 15:41
Show Gist options
  • Save hkawii/fc613c6803eb1bf1fe84fa28424827bb to your computer and use it in GitHub Desktop.
Save hkawii/fc613c6803eb1bf1fe84fa28424827bb to your computer and use it in GitHub Desktop.
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