Karthick
08/25/2023, 6:43 PMGeorge Mount
08/25/2023, 7:14 PMAnimatedVisibility
also. It should just work.Karthick
08/26/2023, 9:34 AMcurrentState
as val referring initialState
is wrong. Technically it is wrong, it is not currentState.Karthick
08/26/2023, 9:34 AMval state = remember { SeekableTransitionState(false, true) }
val transition = rememberTransition(state)
val scope = rememberCoroutineScope()
Column(
Modifier.background(Color.White).fillMaxWidth(0.6f)
) {
BasicText(transition.targetState.toString())
BasicText(text = "Click", modifier = Modifier.clickable {
scope.launch {
if (state.currentState) state.animateToTargetState()
else state.animateToCurrentState()
}
})
Spacer(modifier = Modifier.padding(24.dp))
transition.AnimatedVisibility(
visible = { it }
) {
BasicText("AnimatedVisibility")
}
}
Karthick
08/26/2023, 9:34 AMscope.launch {
if (state.currentState) state.animateToTargetState()
else state.animateToCurrentState()
}
Karthick
08/26/2023, 9:37 AMAnimatedVisibility
one supports MutableTransitionState
and another Transition.AnimatedVisiblity
. To hold the currentState i have to create one more state and using LaunchedEffect
to change thatKarthick
11/06/2023, 3:32 PMStylianos Gakis
11/06/2023, 3:34 PM