From 8b53e5ad102a0a915756004b51c0a58b109e3263 Mon Sep 17 00:00:00 2001 From: Ahmad Ansori Palembani Date: Fri, 17 Jan 2025 09:26:22 +0700 Subject: [PATCH] fix(AppBar): Adjust title padding --- .../src/main/java/yokai/presentation/core/AppBar.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/presentation/core/src/main/java/yokai/presentation/core/AppBar.kt b/presentation/core/src/main/java/yokai/presentation/core/AppBar.kt index 8fd872d0cf..7582b64429 100644 --- a/presentation/core/src/main/java/yokai/presentation/core/AppBar.kt +++ b/presentation/core/src/main/java/yokai/presentation/core/AppBar.kt @@ -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.