Skip to content

Problem with snackbar location #1

@Maxxan

Description

@Maxxan

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")
        }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions