Glass Bottom Bar
Create a glass bottom bar

Goals

What you will learn
Steps
Exercise: Add a tinted glass icon button

Last updated
Create a glass bottom bar



Last updated
Box(Modifier.fillMaxSize()) {
MainNavHost()
}Box(Modifier.fillMaxSize()) {
val backdrop = rememberLayerBackdrop()
MainNavHost(
modifier = Modifier.layerBackdrop(backdrop)
)
Box(
Modifier
.safeContentPadding()
.drawBackdrop(
backdrop = backdrop,
shape = { CircleShape },
effects = {
lens(16f.dp.toPx(), 32f.dp.toPx())
}
)
.height(64f.dp)
.fillMaxWidth()
.align(Alignment.BottomCenter)
)
}val backgroundColor = Color.White
val backdrop = rememberLayerBackdrop {
drawRect(backgroundColor)
drawContent()
}Modifier.drawBackdrop(
backdrop = backdrop,
shape = { CircleShape },
effects = {
vibrancy()
blur(4f.dp.toPx())
lens(16f.dp.toPx(), 32f.dp.toPx())
}
)Modifier.drawBackdrop(
backdrop = backdrop,
shape = { CircleShape },
effects = {
vibrancy()
blur(4f.dp.toPx())
lens(16f.dp.toPx(), 32f.dp.toPx())
},
onDrawSurface = { drawRect(Color.White.copy(alpha = 0.5f)) }
)Box(Modifier.fillMaxSize()) {
val backgroundColor = Color.White
val backdrop = rememberLayerBackdrop {
drawRect(backgroundColor)
drawContent()
}
MainNavHost(
modifier = Modifier.layerBackdrop(backdrop)
)
Box(
Modifier
.safeContentPadding()
.drawBackdrop(
backdrop = backdrop,
shape = { CircleShape },
effects = {
vibrancy()
blur(4f.dp.toPx())
lens(16f.dp.toPx(), 32f.dp.toPx())
},
onDrawSurface = { drawRect(Color.White.copy(alpha = 0.5f)) }
)
.height(64f.dp)
.fillMaxWidth()
.align(Alignment.BottomCenter)
)
}Box(Modifier.fillMaxSize()) {
val backgroundColor = Color.White
val backdrop = rememberLayerBackdrop {
drawRect(backgroundColor)
drawContent()
}
MainNavHost(
modifier = Modifier.layerBackdrop(backdrop)
)
Row(
Modifier
.safeContentPadding()
.height(64f.dp)
.fillMaxWidth()
.align(Alignment.BottomCenter),
horizontalArrangement = Arrangement.spacedBy(8f.dp),
verticalAlignment = Alignment.CenterVertically
) {
Box(
Modifier
.drawBackdrop(
backdrop = backdrop,
shape = { CircleShape },
effects = {
vibrancy()
blur(4f.dp.toPx())
lens(16f.dp.toPx(), 32f.dp.toPx())
},
onDrawSurface = { drawRect(Color.White.copy(alpha = 0.5f)) }
)
.fillMaxHeight()
.weight(1f)
)
Box(
Modifier
.drawBackdrop(
backdrop = backdrop,
shape = { CircleShape },
effects = {
vibrancy()
blur(4f.dp.toPx())
lens(16f.dp.toPx(), 32f.dp.toPx())
},
onDrawSurface = {
val tint = Color(0xFF0088FF)
drawRect(tint, blendMode = BlendMode.Hue)
drawRect(tint.copy(alpha = 0.75f))
}
)
.aspectRatio(1f)
)
}
}