Fixed
Status Update
Comments
pa...@google.com <pa...@google.com> #2
Partly, this is my fault -- val is not that useful in the @Model context, since @Model relies on mutability. I am used to thinking in terms of immutable viewstates and screwed this up.
However, it probably should not crash this way. Either it should work (with a never-changing value) or it should fail with a "are you *really* sure you want this here?" sort of error.
However, it probably should not crash this way. Either it should work (with a never-changing value) or it should fail with a "are you *really* sure you want this here?" sort of error.
pa...@google.com <pa...@google.com> #3
I'd like to add that declaring `canProceed` as a `var` won't crash the app.
The extension function is avoidable by just having the `get()`-getter function inside the class itself. That also avoids the crash.
The extension function is avoidable by just having the `get()`-getter function inside the class itself. That also avoids the crash.
po...@google.com <po...@google.com>
pa...@google.com <pa...@google.com> #4
Try,
@Model
data class AgreementViewState(var terms: Boolean, var privacy: Boolean) {
val canProceed get() = terms && privacy
}
(note the addtion of get()) which seems to be what you intended. `val canProceed = terms && privacy` is not a derived property, rather, it is an initialized property.
@Model
data class AgreementViewState(var terms: Boolean, var privacy: Boolean) {
val canProceed get() = terms && privacy
}
(note the addtion of get()) which seems to be what you intended. `val canProceed = terms && privacy` is not a derived property, rather, it is an initialized property.
ap...@google.com <ap...@google.com> #5
Yes, that echoes comment #3 . It too works, akin to fun canProceed(), an external extension function, and a var. So, in terms of having working approaches, I'm good.
I'll still argue that the initialized val shouldn't blow up the way that it does, though.
I'll still argue that the initialized val shouldn't blow up the way that it does, though.
Description
I have an AlertDialog containing a LazyVerticalGrid, a confirmButton, and a dismissButton. When the grid gets tall enough to that it needs to scroll, the buttons are left without enough space to display and they'red clipped at the bottom of the dialog. I'm not sure how clear that description is, so I attached a screenshot.