Skip to content

Commit

Permalink
fix(AppBar): Adjust title padding
Browse files Browse the repository at this point in the history
  • Loading branch information
null2264 committed Jan 17, 2025
1 parent 63cdf24 commit 8b53e5a
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 8b53e5a

Please sign in to comment.