Hello everyone! Small question: It is normal to us...
# compose
s
Hello everyone! Small question: It is normal to use Scaffold inside another Scaffold? For example I have main Scaffold with BottomNavigation and NavHost, inside NavHost there another screen that uses Scaffold because need to show Snackbar.
z
I think that nesting scaffolds just to show snackbars is probably not a great idea. You can just pass the snackbar state down from the top, or decouple even more and make lower components ignorant of the snackbar concept entirely and just send events up to higher components which are then responsible for showing snackbars. Or, I think you can create just a snackbar host in a lower component without the whole scaffold (I can’t remember if the api for this is public, thought it was at some point).
👍 3
f
I have scaffold inside scaffold because BottomNavigationBar + individual AppBars per screen
works without a problem if you apply the scaffolds padding
@Zach Klippenstein (he/him) [MOD] if I let a higher Composable show the snackbar it stays around when we switch screens, right?
z
Depends how you do it. If you pass the SnackbarState down, then the child can scope a particular message to its Compose scope
💡 1