Stylianos Gakis
08/12/2022, 11:16 PMScaffold
is that when it shows its size is added to the paddingValues
provided by the Scaffold
and therefore pushes the items inside a bit up when it shows so that it does not show over other items.
Am I wrong in this, do I maybe not remember correctly that I’ve seen this before, or does it sound like I am doing something wrong in my implementation somehow?SnackbarHostState
inside the ScaffoldState
doesn’t seem to be contain what I’m looking for, maybe going for a onPlaced
modifier on my SnackbarHost
is what I have to do.Ian Lake
08/13/2022, 12:22 AMZoltan Demant
08/13/2022, 5:20 AMIan Lake
08/13/2022, 6:16 AMsnackbarHost
by default: snackbarHost: @Composable (SnackbarHostState) -> Unit = { SnackbarHost(it) }
) or a Material3 Scaffold (which does not: snackbarHost: @Composable () -> Unit = {}
) so make sure you are providing your own SnackbarHost
to that parameter if you are using the Material3 Scaffold to get the snackbar to be positioned correctlyZoltan Demant
08/13/2022, 7:27 AMStylianos Gakis
08/13/2022, 8:39 AMcontent @Composable (PaddingValues) -> Unit
.
Should that bottom anchored button simply always be pushed up by the space that the snackbar might take if it were to appear? That would potentially solve this but it’d move that button quite a bit up with seemingly without good reason (for the times the users don’t ever see a snackbar)snackbarHost: @Composable (SnackbarHostState) -> Unit
parameter and I’m now experimenting doing smth like
Scaffold(...) {
Column() {
Stuff()
Spacer(1f)
SnackbarHost(snackbarHostState)
ButtomAttachedButton()
}
}
So that it shows above that content, as https://material.io/components/snackbars#placement is suggesting like in the FAB case. Currently one has to do this manually it seems, the Scaffold
composable doesn’t really help in this case.Zoltan Demant
08/15/2022, 10:20 AM