@@ -67,6 +67,7 @@ class MenuItem(
6767 val closeOnSelect : Boolean = true ,
6868 var isLinkToMenu : Boolean = false ,
6969 var isMenuHierarchyManipulator : Boolean = false ,
70+ val isBackButton : Boolean = false ,
7071 private val action : () -> Unit
7172) {
7273 /* *
@@ -112,6 +113,7 @@ class MenuItem(
112113 isMenuHierarchyManipulator = isMenuHierarchyManipulator,
113114 isSmall = isSmall,
114115 isLinkToMenu = isLinkToMenu,
116+ isBackButton = isBackButton,
115117 menuSize = menuSize,
116118 onClick = { select() }
117119 )
@@ -185,6 +187,7 @@ private fun MenuItemContent(
185187 isMenuHierarchyManipulator : Boolean ,
186188 isSmall : Boolean ,
187189 isLinkToMenu : Boolean ,
190+ isBackButton : Boolean ,
188191 menuSize : MenuItemSize ,
189192 onClick : () -> Unit
190193) {
@@ -211,6 +214,7 @@ private fun MenuItemContent(
211214 showLabelAsDescription = showLabelAsDescription,
212215 menuSize = menuSize,
213216 isLinkToMenu = isLinkToMenu,
217+ isBackButton = isBackButton,
214218 onClick = onClick
215219 )
216220 }
@@ -260,11 +264,18 @@ private fun RegularMenuItem(
260264 showLabelAsDescription : Boolean ,
261265 menuSize : MenuItemSize ,
262266 isLinkToMenu : Boolean ,
267+ isBackButton : Boolean ,
263268 onClick : () -> Unit
264269) {
265270 // Ring item: icon (or short text stand-in for label-only items) inside a
266271 // coloured circle, full label stacked underneath. Every item gets the same
267- // circle background for visual consistency across the ring.
272+ // circle background for visual consistency across the ring — except the
273+ // back button, which uses the secondary container so users can pick it
274+ // out at a glance.
275+ val circleColor = if (isBackButton) MaterialTheme .colorScheme.secondaryContainer
276+ else MaterialTheme .colorScheme.primaryContainer
277+ val iconTint = if (isBackButton) MaterialTheme .colorScheme.onSecondaryContainer
278+ else MaterialTheme .colorScheme.onPrimaryContainer
268279 Column (
269280 modifier = Modifier
270281 .fillMaxSize()
@@ -280,7 +291,7 @@ private fun RegularMenuItem(
280291 modifier = Modifier
281292 .size(menuSize.containerCircleSize)
282293 .clip(CircleShape )
283- .background(MaterialTheme .colorScheme.primaryContainer ),
294+ .background(circleColor ),
284295 contentAlignment = Alignment .Center
285296 ) {
286297 // `circleText` overrides the icon: callers set it on items whose
@@ -298,7 +309,7 @@ private fun RegularMenuItem(
298309 )
299310 Text (
300311 text = circleText,
301- color = MaterialTheme .colorScheme.onPrimaryContainer ,
312+ color = iconTint ,
302313 fontSize = effectiveFontSize,
303314 textAlign = TextAlign .Center ,
304315 maxLines = 1
@@ -308,7 +319,7 @@ private fun RegularMenuItem(
308319 painter = painterResource(id = drawableId),
309320 contentDescription = labelResource?.let { Resources .getString(it) },
310321 modifier = Modifier .size(menuSize.iconSize),
311- tint = MaterialTheme .colorScheme.onPrimaryContainer
322+ tint = iconTint
312323 )
313324 } else if (text != null ) {
314325 // Cap the in-circle letter so the user's system font scale
@@ -326,7 +337,7 @@ private fun RegularMenuItem(
326337 }
327338 Text (
328339 text = circleInitials(text),
329- color = MaterialTheme .colorScheme.onPrimaryContainer ,
340+ color = iconTint ,
330341 fontSize = effectiveFontSize,
331342 textAlign = TextAlign .Center ,
332343 maxLines = 1
0 commit comments