I'm trying to show and hide ProgressIndicator in a column.
the problem is when I want to hide the ProgressIndicator, the space between other widgets will be removed too (like View.GONE) but I want to keep widget size (like View.INVISIBLE)
example:
@Composable
fun Main(isLoading: Boolean) {
Column {
Text(text = "Text")
if (isLoading) {
CircularProgressIndicator()
}
Button(onClick = { /*clicked*/ }, content = { Text(text = "Button") })
}
}
I found a solution but I'm not sure if it's the right way.
if (isLoading) {
CircularProgressIndicator()
} else {
Spacer(modifier = Modifier.height(40.dp))
}
Is there any other way for making the widget invisible like View.INVISIBLE?
How can I get widget size to set Spacer size?
Thanks
