|
|
|
@ -29,6 +29,10 @@ import androidx.compose.ui.graphics.Color
|
|
|
|
|
import androidx.compose.ui.unit.dp
|
|
|
|
|
import com.google.samples.apps.nowinandroid.core.designsystem.icon.NiaIcons
|
|
|
|
|
|
|
|
|
|
private const val DISABLED_CHIP_CONTAINER_ALPHA = 0.12f
|
|
|
|
|
private const val DISABLED_CHIP_CONTENT_ALPHA = 0.38f
|
|
|
|
|
private val chipBorderWidth = 1.dp
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Now in Android filter chip with included leading checked icon as well as text content slot.
|
|
|
|
|
*
|
|
|
|
@ -73,28 +77,28 @@ fun NiaFilterChip(
|
|
|
|
|
borderColor = MaterialTheme.colorScheme.onBackground,
|
|
|
|
|
selectedBorderColor = MaterialTheme.colorScheme.onBackground,
|
|
|
|
|
disabledBorderColor = MaterialTheme.colorScheme.onBackground.copy(
|
|
|
|
|
alpha = NiaChipDefaults.DisabledChipContentAlpha,
|
|
|
|
|
alpha = DISABLED_CHIP_CONTENT_ALPHA,
|
|
|
|
|
),
|
|
|
|
|
disabledSelectedBorderColor = MaterialTheme.colorScheme.onBackground.copy(
|
|
|
|
|
alpha = NiaChipDefaults.DisabledChipContentAlpha,
|
|
|
|
|
alpha = DISABLED_CHIP_CONTENT_ALPHA,
|
|
|
|
|
),
|
|
|
|
|
selectedBorderWidth = NiaChipDefaults.ChipBorderWidth,
|
|
|
|
|
selectedBorderWidth = chipBorderWidth,
|
|
|
|
|
),
|
|
|
|
|
colors = FilterChipDefaults.filterChipColors(
|
|
|
|
|
labelColor = MaterialTheme.colorScheme.onBackground,
|
|
|
|
|
iconColor = MaterialTheme.colorScheme.onBackground,
|
|
|
|
|
disabledContainerColor = if (selected) {
|
|
|
|
|
MaterialTheme.colorScheme.onBackground.copy(
|
|
|
|
|
alpha = NiaChipDefaults.DisabledChipContainerAlpha,
|
|
|
|
|
alpha = DISABLED_CHIP_CONTAINER_ALPHA,
|
|
|
|
|
)
|
|
|
|
|
} else {
|
|
|
|
|
Color.Transparent
|
|
|
|
|
},
|
|
|
|
|
disabledLabelColor = MaterialTheme.colorScheme.onBackground.copy(
|
|
|
|
|
alpha = NiaChipDefaults.DisabledChipContentAlpha,
|
|
|
|
|
alpha = DISABLED_CHIP_CONTENT_ALPHA,
|
|
|
|
|
),
|
|
|
|
|
disabledLeadingIconColor = MaterialTheme.colorScheme.onBackground.copy(
|
|
|
|
|
alpha = NiaChipDefaults.DisabledChipContentAlpha,
|
|
|
|
|
alpha = DISABLED_CHIP_CONTENT_ALPHA,
|
|
|
|
|
),
|
|
|
|
|
selectedContainerColor = MaterialTheme.colorScheme.primaryContainer,
|
|
|
|
|
selectedLabelColor = MaterialTheme.colorScheme.onBackground,
|
|
|
|
@ -102,14 +106,3 @@ fun NiaFilterChip(
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Now in Android chip default values.
|
|
|
|
|
*/
|
|
|
|
|
object NiaChipDefaults {
|
|
|
|
|
// TODO: File bug
|
|
|
|
|
// FilterChip default values aren't exposed via FilterChipDefaults
|
|
|
|
|
const val DisabledChipContainerAlpha = 0.12f
|
|
|
|
|
const val DisabledChipContentAlpha = 0.38f
|
|
|
|
|
val ChipBorderWidth = 1.dp
|
|
|
|
|
}
|
|
|
|
|