mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-11 15:29:15 +01:00
align the library headline height with the title bar
This commit is contained in:
@@ -155,11 +155,13 @@ fun LibraryScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val density = LocalDensity.current
|
val density = LocalDensity.current
|
||||||
val titleHeight =
|
val titleHeight = TopAppBarDefaults.TopAppBarExpandedHeight
|
||||||
|
val titleLineHeight =
|
||||||
with(density) {
|
with(density) {
|
||||||
MaterialTheme.typography.headlineLarge.lineHeight
|
MaterialTheme.typography.headlineLarge.lineHeight
|
||||||
.toDp()
|
.toDp()
|
||||||
} + 12.dp
|
}
|
||||||
|
val titleTop = ((titleHeight - titleLineHeight) / 2).coerceAtLeast(0.dp)
|
||||||
val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior()
|
val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior()
|
||||||
SideEffect { scrollBehavior.state.heightOffsetLimit = -with(density) { titleHeight.toPx() } }
|
SideEffect { scrollBehavior.state.heightOffsetLimit = -with(density) { titleHeight.toPx() } }
|
||||||
val titleFraction = scrollBehavior.state.collapsedFraction
|
val titleFraction = scrollBehavior.state.collapsedFraction
|
||||||
@@ -195,7 +197,7 @@ fun LibraryScreen(
|
|||||||
Modifier
|
Modifier
|
||||||
.offset(y = -(titleHeight * titleFraction))
|
.offset(y = -(titleHeight * titleFraction))
|
||||||
.wrapContentHeight(unbounded = true)
|
.wrapContentHeight(unbounded = true)
|
||||||
.padding(start = 16.dp, end = 16.dp, top = 8.dp, bottom = 4.dp),
|
.padding(start = 16.dp, end = 16.dp, top = titleTop),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
LibraryTabs(
|
LibraryTabs(
|
||||||
|
|||||||
Reference in New Issue
Block a user