Fixed (?) rendering issue with calculated value text

Hard to catch this bug, may still be broken
This commit is contained in:
Sad Ellie 2022-11-20 20:32:05 +04:00
parent 7c38a60788
commit e0152b508e

View File

@ -23,8 +23,10 @@ import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.SizeTransform
import androidx.compose.animation.expandHorizontally
import androidx.compose.animation.expandVertically
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.shrinkVertically
import androidx.compose.animation.with
import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.interaction.MutableInteractionSource
@ -124,6 +126,11 @@ fun MyTextField(
}
}
AnimatedVisibility(
visible = !secondaryText.isNullOrEmpty(),
enter = expandVertically(),
exit = shrinkVertically()
) {
LazyRow(
modifier = modifier
.wrapContentHeight(),
@ -132,23 +139,19 @@ fun MyTextField(
contentPadding = PaddingValues(horizontal = 8.dp)
) {
item {
AnimatedVisibility(visible = !secondaryText.isNullOrEmpty()) {
AnimatedContent(targetState = secondaryText,
AnimatedContent(
targetState = secondaryText,
transitionSpec = {
// Enter animation
(expandHorizontally(
clip = false,
expandFrom = Alignment.Start
) + fadeIn()
(expandHorizontally(clip = false, expandFrom = Alignment.Start) + fadeIn()
// Exit animation
with fadeOut())
.using(SizeTransform(clip = false))
}
) {
Text(
modifier = Modifier
.fillMaxWidth(),
text = Formatter.format(secondaryText ?: ""),
modifier = Modifier,
text = Formatter.format(it ?: ""),
textAlign = TextAlign.End,
softWrap = false,
color = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.6f),