Marcin Wisniowski
05/08/2023, 12:54 PMLargeTopAppBar
, with exitUntilCollapsedScrollBehavior
so it collapses on scroll. My title is long and takes 2 lines in the expanded state which is expected, but it also takes 2 lines in the collapsed state and looks wrong (it should be truncated instead with an ellipsis, this is also what the design doc states). I'm not sure how to make it behave correctly. I can't change my Text
based on the collapsed state because in the intermediate states the title is visible twice, both in the expanded and collapsed states (one fades out and other fades in), so changing it changes it for both.Sean Proctor
05/08/2023, 1:22 PMMarcin Wisniowski
05/08/2023, 1:34 PMSean Proctor
05/08/2023, 1:47 PMMarcin Wisniowski
05/08/2023, 2:01 PMtitle
block whether I'm in the expanded or collapsed state, I could handle it correctly, but I can't (I can't rely on the external app bar state / scroll behavior state because both titles are shown at the same time during the animation).BoxWithConstraints
to detect the different available height, which feels hacky but could maybe work.Sean Proctor
05/08/2023, 2:04 PMtitle
have a parameter.Marcin Wisniowski
05/08/2023, 2:26 PMLargeTopAppBar
sets a different LocalTextStyle
for the expanded and collapsed state, which I can detect:
title = {
val expandedTextStyle = MaterialTheme.typography.headlineMedium
val isExpanded = LocalTextStyle.current == expandedTextStyle
Text() // correct styling based on isExpanded
}