Skip to content

Commit

Permalink
Change background color of selected deletion period in dropdown menu
Browse files Browse the repository at this point in the history
  • Loading branch information
msasikanth committed Feb 7, 2024
1 parent a303a9f commit 6911f24
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package dev.sasikanth.rss.reader.settings.ui

import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
Expand Down Expand Up @@ -338,17 +339,25 @@ private fun PostsDeletionPeriodSettingItem(
ONE_YEAR -> LocalStrings.current.settingsPostsDeletionPeriodOneYear
}

val backgroundColor =
if (period == postsDeletionPeriod) {
AppTheme.colorScheme.tintedSurface
} else {
Color.Unspecified
}

DropdownMenuItem(
onClick = {
onValueChanged(period)
showDropdown = false
}
},
modifier = Modifier.background(backgroundColor)
) {
val textColor =
if (period == postsDeletionPeriod) {
AppTheme.colorScheme.tintedForeground
} else {
AppTheme.colorScheme.onSurface
} else {
AppTheme.colorScheme.textEmphasisHigh
}

Text(text = periodString, style = MaterialTheme.typography.bodyLarge, color = textColor)
Expand Down

0 comments on commit 6911f24

Please sign in to comment.