Try to fix common issue with the top app bar (#6187)

The exception is:

> Size(720 x -83) is out of range. Each dimension must be between 0 and 16777215.

So forcing the height to at least 0 should fix it (although it might cause UI glitches?)
This commit is contained in:
Jorge Martin Espinosa 2026-02-16 09:42:41 +01:00 committed by GitHub
parent d430f308c1
commit b8865d550d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -45,7 +45,7 @@ fun TopAppBarScrollBehaviorLayout(
val contentHeight = placeable.height.toFloat()
scrollBehavior.state.heightOffsetLimit = -contentHeight
val heightOffset = scrollBehavior.state.heightOffset
val layoutHeight = (contentHeight + heightOffset).toInt()
val layoutHeight = (contentHeight + heightOffset).toInt().coerceAtLeast(0)
layout(placeable.width, layoutHeight) {
placeable.place(0, heightOffset.toInt())
}