Closed russellbanks closed 1 year ago
Did you try to add a tint of color, "Color.Unspecified" which according to the Icon component would not apply a tint to the icon?
Did you try to add a tint of color, "Color.Unspecified" which according to the Icon component would not apply a tint to the icon?
Color.Unspecified
doesn't change anything here - it's still tinted:
Hmm I just checked and this seems to work:
icon = IconSource(
R.drawable.ic_fruit_apple,
tint = Color.Unspecified
)
It's gray by default and the color is kept. When I use Color.RED, it's red. If I remove tint / keep it null, it uses the secondary color.
I guess you are not using a DrawableRes? Maybe it doesn't work for each type atm.
I was doing it as a painterResource before, but it's still like that even with drawableRes:
if (imageSheetVisible) {
ModalBottomSheet(
onDismissRequest = { imageSheetVisible = false },
sheetState = imageSheetState
) {
OptionView(
useCaseState = rememberUseCaseState(),
selection = OptionSelection.Single(
options = listOf(
Option(
icon = IconSource(
drawableRes = R.drawable.image_anahata,
tint = Color.Unspecified
),
titleText = "",
)
),
onSelectOption = { index, option ->
}
),
config = OptionConfig(
mode = DisplayMode.GRID_VERTICAL,
)
)
}
}
My example was with the header.
header = Header.Default(
"Select time",
icon = IconSource(
R.drawable.ic_fruit_apple,
tint = Color.Unspecified
)
),
For the OptionView it makes sense if it doesn't work as it enforces currently the icon color.
val iconColor = if (option.selected) MaterialTheme.colorScheme.primary
else MaterialTheme.colorScheme.onSurface
Same as https://github.com/maxkeppeler/sheets/issues/83 but for Compose dialogs.
There should be an option to keep the icon as is without any tinting at all.
I want the user to be able to choose an image but it looks like that rather than retaining all its colours.