Skip to content

Commit

Permalink
[fluent] Fixed: Add selected color scheme for NavigationItem
Browse files Browse the repository at this point in the history
This commit adds a selected color scheme for NavigationItem in NavigationView.

It updates the default color schemes for NavigationItem based on the display mode and selection state, applying appropriate colors for selected and unselected items in both Top and Side navigation modes.
  • Loading branch information
Sanlorng committed Dec 3, 2024
1 parent 8b5601d commit b47895b
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -696,10 +696,11 @@ fun NavigationMenuItemScope.MenuItem(
indicatorState: IndicatorState? = LocalIndicatorState.current,
onExpandItemsChanged: (Boolean) -> Unit = {},
interactionSource: MutableInteractionSource? = null,
colors: NavigationItemColorScheme = if (displayMode == NavigationDisplayMode.Top) {
NavigationDefaults.defaultTopItemColors()
} else {
NavigationDefaults.defaultSideItemColors()
colors: NavigationItemColorScheme = when {
displayMode == NavigationDisplayMode.Top && selected -> NavigationDefaults.selectedTopItemColors()
displayMode == NavigationDisplayMode.Top -> NavigationDefaults.defaultTopItemColors()
selected -> NavigationDefaults.selectedSideItemColors()
else -> NavigationDefaults.defaultSideItemColors()
},
indicator: @Composable IndicatorScope.(color: Color) -> Unit = if (displayMode == NavigationDisplayMode.Top) {
{ color ->
Expand Down Expand Up @@ -777,10 +778,11 @@ fun NavigationMenuItemScope.MenuItem(
indicatorState: IndicatorState? = LocalIndicatorState.current,
onExpandItemsChanged: (Boolean) -> Unit = {},
interactionSource: MutableInteractionSource? = null,
colors: NavigationItemColorScheme = if (displayMode == NavigationDisplayMode.Top) {
NavigationDefaults.defaultTopItemColors()
} else {
NavigationDefaults.defaultSideItemColors()
colors: NavigationItemColorScheme = when {
displayMode == NavigationDisplayMode.Top && selected -> NavigationDefaults.selectedTopItemColors()
displayMode == NavigationDisplayMode.Top -> NavigationDefaults.defaultTopItemColors()
selected -> NavigationDefaults.selectedSideItemColors()
else -> NavigationDefaults.defaultSideItemColors()
},
indicator: @Composable IndicatorScope.(color: Color) -> Unit = if (displayMode == NavigationDisplayMode.Top) {
{ color ->
Expand Down

0 comments on commit b47895b

Please sign in to comment.