I would very much like to hear ideas regarding he best practices of showing a snackbar when clicking a sub-composable.
I have a pretty deep hierarchy of composables, and it feels weird to pass a ScaffoldStates all the way “down” to the required element, just to invoke a simple method…
07/29/2022, 10:04 AM
Maybe pass a callback instead all the way up?
07/29/2022, 10:07 AM
Yeah I do prefer this approach, but it’s still pretty much the same - I still need to pass the callback across the entire hierarchy…
07/29/2022, 11:02 AM
Maybe pass a ViewModel all the way down (it is going to be useful for other state manipulations anyway). Then inside the viewmodel define a listener.