kclerc
06/15/2020, 11:54 AMDoris Liu
07/16/2020, 1:36 AMDoris Liu
07/16/2020, 1:38 AMDoris Liu
07/16/2020, 1:43 AMkclerc
07/16/2020, 9:16 AMkclerc
07/16/2020, 9:33 AMkclerc
07/16/2020, 9:33 AM@Composable fun MyContainer() {
val (isLoading, setIsLoading) = state { false }
val width = animate(target = if (isLoading) [Retrieve A width] else [Retrieve B width])
Button(
onClick = setIsLoading,
text = {
if (isLoading) {
A(modifier = Modifier.preferredWidth(width))
} else {
B(modifier = Modifier.preferredWidth(width))
}
}
)
}
(it may be better to apply the modifier once to Button
)
Is there a way to āmeasureā A and B without having them displayed ?