galex
02/09/2023, 3:32 PMgalex
02/09/2023, 4:00 PMBox {
val showLoader = state == ButtonMainState.Loader
Row(modifier = Modifier.alpha(if (showLoader) 0f else 1f)) {
val color =
when {
enabled.not() -> style.disabledContentColor
else -> style.idleContentColor
}
icon?.let {
Image(
painter = painterResource(id = it),
contentDescription = iconContentDescription,
colorFilter = ColorFilter.tint(color),
modifier = Modifier.size(16.dp)
)
Spacer(modifier = Modifier.width(8.dp))
}
Text(
text = text,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
style = size.textStyle,
color = color
)
}
if (showLoader) {
SomeProgressBar(
modifier = Modifier.size(size.loaderSize).align(Alignment.Center),
)
}
}
Any better approach would be greatly welcomed 😊Alex Vanyo
02/09/2023, 7:20 PMalpha
is that it leaves all of that content in place semantically, which isn’t quite optimal, but that’s on the right track to a solution. If you instead measure (but don’t place), you can keep the size the same while preventing the content from being in the semantic tree.galex
02/10/2023, 6:23 PM