@@ -21,6 +21,7 @@ import androidx.compose.animation.BoundsTransform
2121import androidx.compose.animation.EnterTransition
2222import androidx.compose.animation.ExitTransition
2323import androidx.compose.animation.animateBounds
24+ import androidx.compose.animation.core.animateDpAsState
2425import androidx.compose.animation.core.snap
2526import androidx.compose.animation.slideInHorizontally
2627import androidx.compose.animation.slideInVertically
@@ -31,6 +32,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
3132import androidx.compose.foundation.layout.height
3233import androidx.compose.foundation.layout.navigationBarsPadding
3334import androidx.compose.foundation.layout.size
35+ import androidx.compose.foundation.shape.RoundedCornerShape
3436import androidx.compose.material3.Badge
3537import androidx.compose.material3.BadgedBox
3638import androidx.compose.material3.BottomAppBarDefaults
@@ -42,8 +44,10 @@ import androidx.compose.material3.Surface
4244import androidx.compose.material3.Text
4345import androidx.compose.material3.contentColorFor
4446import androidx.compose.runtime.Composable
47+ import androidx.compose.runtime.getValue
4548import androidx.compose.ui.Alignment
4649import androidx.compose.ui.Modifier
50+ import androidx.compose.ui.graphics.Shape
4751import androidx.compose.ui.layout.LookaheadScope
4852import androidx.compose.ui.unit.dp
4953import com.tunjid.heron.ui.UiTokens
@@ -125,8 +129,9 @@ internal fun AppState.PaneNavigationBar(
125129 modifier = modifier
126130 .fillMaxWidth()
127131 .animateBounds(lookaheadScope = this @LookaheadScope),
128- color = BottomAppBarDefaults .containerColor,
132+ color = BottomAppBarDefaults .containerColor.copy(alpha = BackgroundAlpha ) ,
129133 contentColor = contentColorFor(BottomAppBarDefaults .containerColor),
134+ shape = navigationBarShape(prefersCompactBottomNav),
130135 ) {
131136 Row (
132137 modifier = Modifier
@@ -225,9 +230,28 @@ fun Modifier.bottomNavigationSharedBounds(
225230 }
226231}
227232
233+ @Composable
234+ fun navigationBarShape (
235+ prefersCompactBottomNav : Boolean ,
236+ ): Shape {
237+ val topCornerSize by animateDpAsState(
238+ if (prefersCompactBottomNav) CompactCornerSize else RegularCornerSize ,
239+ )
240+
241+ return RoundedCornerShape (
242+ topStart = topCornerSize,
243+ topEnd = topCornerSize,
244+ )
245+ }
246+
228247private data object NavigationBarSharedElementKey
229248private data object NavigationRailSharedElementKey
230249
250+ private val CompactCornerSize = 0 .dp
251+ private val RegularCornerSize = 16 .dp
252+
231253private const val MaxBadgeCount = 100L
232254
255+ private const val BackgroundAlpha = 0.98f
256+
233257private val NavigationRailBoundsTransform = BoundsTransform { _, _ -> snap() }
0 commit comments