I am experiencing an issue similar to this one on ...
# compose
I am experiencing an issue similar to this one on stackoverflow::https://stackoverflow.com/questions/72586273/how-to-set-dynamic-position-of-snackbar-in-jetpack-compose Any insights will be appreciated
How does it work now? Does the snackbar get hidden behind the navigation bar? Do you need the snackbar to be available for both screens? If yes, I’d say the inner screen doesn’t need to be a Scaffold. One Scaffold that has the NavHost inside should suffice, and there can be a single source of truth of the snackbar state there. And the two screens can be passed in a lambda to show something to the snackbar. Or am I misunderstanding your problem maybe?
Can you add
.windowInsetsPadding(WindowInsets.safeDrawing.only(WindowInsetsSides.Horizontal + WindowInsetsSides.Bottom))
to your snackbar? I believe if the Scaffold is in fact showing a bottom tab it should have consumed them therefore they should be a no-op for the snackbar, and if the scaffold has not consumed them (in the screen you’re showing here) since there is no bottom bar then the
should add the necessary padding. I’d give this a try
The above solution works well for the page without bottom navigation but whenever there is bottom navigation, the snackbar has some extra margin above the bottom navigation
Interesting, maybe those insets are not actually consumed from the scaffold. Could you try doing something like
manually yourself in that case so that you tell the insets that “I’ve already applied these, do not apply them again later when someone asks for it”. It’s getting a bit hard to keep all these things in my head now without looking at the code itself, but I hope this at least gives you an idea of what I am going for with this suggestion.