You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is because the minimum height is changing because of the "real" title text. As the toolbar collapses, the font size of the title text also shrinks, which causes the text to have less lines than the previous state. The reduction of the line count makes the text to have smaller minimum height, and the toolbar's minimum height also gets smaller. This causes the progress to jump because its calculation depends on the minimum height and maximum height. The progress has changed and your font size gets bigger and the composition gets in an infinite loop. As a proof, notice that the toolbar's progress in your video only jumps when the line count changes.
The solution is to put another fake composable to specify minimum height. A snippet below seems to fix your case.
Text( // this is fake item to allocate space
text = title,
modifier =Modifier
.alpha(0F)
.padding(start =16.dp, top =12.dp +56.dp, end =16.dp, bottom =16.dp)
.pin(),
style =MaterialTheme.typography.h4,
)
Text( // <-- ADDED: fake item to specify minimum height
text = title,
modifier =Modifier
.alpha(0F)
.padding(start =16.dp, top =16.dp, end =16.dp, bottom =16.dp)
.pin(),
maxLines =1,
fontSize = originalFontSize.value.sp,
style =MaterialTheme.typography.h6,
)
Text(
text = title,
modifier =Modifier
.padding(leftPadding, 16.dp, 16.dp, 16.dp)
.road(Alignment.CenterStart, Alignment.BottomStart),
fontSize = textSize,
style =MaterialTheme.typography.h6,
maxLines = titleCurrentMaxLines,
)
onebone
added
wontfix
This will not be worked on; intended behavior
and removed
bug
Unexpected behavior or crash that disrupts library usage
labels
Apr 12, 2022
I have created a sample to reproduce the behavior on a video.
tested on devices: SGS10 with android 12 and pixel 3a with android 12
2022-03-16.16.12.31.mp4
The text was updated successfully, but these errors were encountered: