fix(AppBar): Adjust title padding

This commit is contained in:
Ahmad Ansori Palembani 2025-01-17 09:26:22 +07:00
parent 63cdf247b4
commit 8b53e5ad10
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6

View file

@ -523,14 +523,14 @@ private class TopAppBarMeasurePolicy(
// Apply bottom padding from the title's baseline only when the Arrangement
// is "Bottom".
Arrangement.Bottom -> {
val padding = if (titleBottomPadding == 0) {
(constraints.maxHeight - titlePlaceable.height) / 2
} else {
titleBottomPadding - (titlePlaceable.height - titleBaseline)
}
// Calculate the actual padding from the bottom of the title, taking
// into account its baseline.
val paddingFromBottom = padding - (titlePlaceable.height - titleBaseline)
val adjustedTitleHeight = titlePlaceable.height - titleBaseline
val paddingFromBottom = if (titleBottomPadding == 0) {
(constraints.maxHeight - adjustedTitleHeight) / 2
} else {
titleBottomPadding - adjustedTitleHeight
}
// Adjust the bottom padding to a smaller number if there is no room
// to fit the title.