robnik
05/31/2021, 7:35 PMrobnik
05/31/2021, 7:35 PMfun Outer() {
val thing = pieceOfViewModel()
Column {
BackButton() {
if (inner editor is valid) { save() }
else { showInnerEditorsAlert() }
}
InnerEditor(thing)
}
}
fun InnerEditor(thing: Thing) {
val text = remember { mutableStateOf("") {
// some editor controls
// if text is "valid" then it would want to let the back button work in Outer
}
Kirill Grouchnikov
05/31/2021, 7:40 PMrobnik
05/31/2021, 8:15 PMisValid: Boolean
mutable state would need to be computed and set on every change, inside InnerEditor. But I want it to be lazy, only computed when the person tries to go "back" in Outer.Zach Klippenstein (he/him) [MOD]
06/01/2021, 12:53 PMrobnik
06/01/2021, 3:47 PM@Composable EditScreen(...)
method, which each Filter overrides differently. So if I hoist the Inner/Filter state, I need to create an abstract InnerState
which all the different Inners could implement differently. I may try that, but it may be more complicated than the hack I came up with yesterday, which was to remember a coroutine Channel
in Outer and send a message "downward" into Inner with that.Kirill Grouchnikov
06/01/2021, 6:26 PM