SpeedDialFloatingActionButton
SpeedDialFloatingActionButton copied to clipboard
Problem with snackbar location
Thanks for a very good component!
I tried the M3 version, and unfortunately there is a problem with snackbars. The are shown above all the (invisible) sub FABs (in the middle of the screen, vertically) instead of above the navigation bar as it should.
Any idea how to fix this?
Here is some code to reproduce the problem:
val snackbarHostState = remember { SnackbarHostState() }
val snackbarCoroutineScope = rememberCoroutineScope()
val fabState = rememberSpeedDialFloatingActionButtonState()
Scaffold(
bottomBar = {
BottomAppBar(
actions = {},
floatingActionButton = {
BottomAppBarSpeedDialFloatingActionButton(
state = fabState
) {
Icon(Icons.Default.Add, contentDescription = null)
}
}
)
},
floatingActionButton = {
SubSpeedDialFloatingActionButtons(
state = fabState,
items = listOf(
FloatingActionButtonItem(
icon = Icons.Default.Person,
label = "Person"
) {},
FloatingActionButtonItem(
icon = Icons.Default.Home,
label = "Home"
) {}
)
)
},
snackbarHost = { SnackbarHost(snackbarHostState) },
) {
Button(onClick = { snackbarCoroutineScope.launch { snackbarHostState.showSnackbar("Snackbar") } }) {
Text("Show snackbar")
}
}