Is it possible to change the compositionLocal insi...
# compose
j
Is it possible to change the compositionLocal inside AppBar to avoid adding an alpha to the content?
1
l
You can just explicitly set a new value for
LocalContentAlpha
inside, or explicitly ignore it by doing
color = LocalContentColor.current
(and ignoring the alpha that is usually applied to text / icons)
👍 1
j
But because the inner one is using
medium
instead of
high
(which I want to use), even if I provide one, the inner one will be used no? because the implementation detail inside material is wrapping the surface with the content, and mine is wrapping that, but it is external 🤔
c
It should resolve to the closest LocalContentAlpha, which would be yours because your change is within
content()
👍 1
I’ve done this successfully with content slots in
TopAppBar
like for the actions slot.
For example:
Copy code
actions = {
    Icon(
        ...,
        tint = LocalContentColor.current.copy(alpha = ContentAlpha.high)
    )
}