theapache64
03/05/2022, 3:38 PMIndication
? 🤔
I am having trouble understanding how do I animate inside IndicationInstance#ContentDrawScope.drawIndication()
.Problem is, its not a @Composable
method, which means I can’t use animation API methods such as animateXXXasState()
Adam Powell
03/05/2022, 3:49 PMIndication.rememberUpdatedInstance(InteractionSource)
is a @Composable
function. Any instance-specific composition to observe the InteractionSource
and animate the returned IndicationInstance
can be done theretheapache64
03/05/2022, 6:07 PMLouis Pullen-Freilich [G]
03/05/2022, 7:25 PMIndicationInstance
that draws some indication, and draws the ripple indication as well, although this sounds a bit suspicious and maybe not what you actually would want to do?
On a side note, there is not much guidance currently - but it is something we are working on.theapache64
03/05/2022, 7:53 PMLouis Pullen-Freilich [G]
03/05/2022, 8:13 PMModifier.indication(/* ripple */).indication(/** custom indication */)
So have two different indications, one for the ripple and one for your custom one.
Or you could create an instance that wraps the ripple instance, and draws both:
class CustomIndicationInstance(private val rippleInstance: IndicationInstance) : IndicationInstance {
override fun ContentDrawScope.drawIndication() {
// draw content, and ripple
with (rippleInstance) { drawIndication() }
// draw custom indication on top of ripple
...
}
}
Depends what exactly you want to dotheapache64
03/05/2022, 8:15 PMLouis Pullen-Freilich [G]
03/05/2022, 8:16 PMtheapache64
03/05/2022, 8:47 PM