@@ -277,13 +277,14 @@ class TopAppBarState(
277277 initialHeightOffset : Float ,
278278 initialContentOffset : Float
279279) {
280+
280281 /* *
281282 * The top app bar's height offset limit in pixels, which represents the limit that a top app
282283 * bar is allowed to collapse to.
283284 *
284285 * Use this limit to coerce the [heightOffset] value when it's updated.
285286 */
286- var heightOffsetLimit by mutableFloatStateOf( initialHeightOffsetLimit)
287+ var heightOffsetLimit = initialHeightOffsetLimit
287288
288289 /* *
289290 * The top app bar's current height offset in pixels. This height offset is applied to the fixed
@@ -583,16 +584,18 @@ private fun TopAppBarLayout(
583584 }
584585
585586 // Small Title Animation
586- val extOffset by remember(scrolledOffset ) {
587+ val extOffset by remember(heightOffset ) {
587588 derivedStateOf {
588- abs(scrolledOffset.offset() ) / expandedHeightPx * 2
589+ abs(heightOffset ) / expandedHeightPx * 2
589590 }
590591 }
591592
593+ println (" extOffset: ${extOffset.coerceIn(0f , 1f )} " )
594+
592595 // Large Title Alpha Animation
593- val largeTitleAlpha by remember(scrolledOffset , expandedHeightPx) {
596+ val largeTitleAlpha by remember(heightOffset , expandedHeightPx) {
594597 derivedStateOf {
595- 1f - (abs(scrolledOffset.offset() ) / expandedHeightPx * 2 ).coerceIn(0f , 1f )
598+ 1f - (abs(heightOffset ) / expandedHeightPx * 2 ).coerceIn(0f , 1f )
596599 }
597600 }
598601
0 commit comments