Google recommends just placing it inside the bottom navbar.
But to answer your question: spent a good two days figuring this out. Turns out you can just wrap your FAB in a Box
and use Modifier.offset
. As far as I can tell, pointerInput
is accurate as well. There are probably a few ways to do this, and this is likely far from the best.
You'll probably need to manually compute the exact offset you're looking for based on screen size, height of the bottom nav, etcetera. But this is a relatively easy way to achieve the docked FAB, at least.
Scaffold(
modifier = Modifier,
floatingActionButton = {
Box(){
FloatingActionButton(
onClick = { /* stub */ },
shape = CircleShape,
modifier = Modifier
.align(Alignment.Center)
.size(80.dp)
.offset(y = 50.dp)
) {
Icon(
imageVector = FontAwesomeIcons.Solid.Plus,
contentDescription = null,
modifier = Modifier.size(45.dp)
)
}
}
},
floatingActionButtonPosition = FabPosition.Center,
content = { Content() },
bottomBar = {
BottomNavWr(
navController,
tabs
)
}
)
Produces something similar to the following, depending on other code:
