mirror of
https://github.com/null2264/yokai.git
synced 2025-06-20 18:24:42 +00:00
fix(AppBar): Use maxLayoutHeight instead of constraints.maxHeight
Also revert padding changes
This commit is contained in:
parent
d2ddf7dfb0
commit
ece849b008
1 changed files with 11 additions and 10 deletions
|
@ -475,11 +475,12 @@ private class TopAppBarMeasurePolicy(
|
||||||
y =
|
y =
|
||||||
when (titleVerticalArrangement) {
|
when (titleVerticalArrangement) {
|
||||||
Arrangement.Bottom -> {
|
Arrangement.Bottom -> {
|
||||||
val paddingFromBottom = (constraints.maxHeight - (navigationIconPlaceable.height - titleBaseline)) / 2
|
val padding = (maxLayoutHeight - navigationIconPlaceable.height) / 2
|
||||||
|
val paddingFromBottom = padding - (navigationIconPlaceable.height - titleBaseline)
|
||||||
val heightWithPadding = paddingFromBottom + navigationIconPlaceable.height
|
val heightWithPadding = paddingFromBottom + navigationIconPlaceable.height
|
||||||
val adjustedBottomPadding =
|
val adjustedBottomPadding =
|
||||||
if (heightWithPadding > constraints.maxHeight) {
|
if (heightWithPadding > maxLayoutHeight) {
|
||||||
paddingFromBottom - (heightWithPadding - constraints.maxHeight)
|
paddingFromBottom - (heightWithPadding - maxLayoutHeight)
|
||||||
} else {
|
} else {
|
||||||
paddingFromBottom
|
paddingFromBottom
|
||||||
}
|
}
|
||||||
|
@ -523,12 +524,11 @@ private class TopAppBarMeasurePolicy(
|
||||||
Arrangement.Bottom -> {
|
Arrangement.Bottom -> {
|
||||||
// Calculate the actual padding from the bottom of the title, taking
|
// Calculate the actual padding from the bottom of the title, taking
|
||||||
// into account its baseline.
|
// into account its baseline.
|
||||||
val adjustedTitleHeight = titlePlaceable.height - titleBaseline
|
|
||||||
val paddingFromBottom = if (titleBottomPadding == 0) {
|
val paddingFromBottom = if (titleBottomPadding == 0) {
|
||||||
(constraints.maxHeight - adjustedTitleHeight) / 2
|
(maxLayoutHeight - titlePlaceable.height) / 2
|
||||||
} else {
|
} else {
|
||||||
titleBottomPadding - adjustedTitleHeight
|
titleBottomPadding
|
||||||
}
|
} - (titlePlaceable.height - titleBaseline)
|
||||||
|
|
||||||
// Adjust the bottom padding to a smaller number if there is no room
|
// Adjust the bottom padding to a smaller number if there is no room
|
||||||
// to fit the title.
|
// to fit the title.
|
||||||
|
@ -555,12 +555,13 @@ private class TopAppBarMeasurePolicy(
|
||||||
y =
|
y =
|
||||||
when (titleVerticalArrangement) {
|
when (titleVerticalArrangement) {
|
||||||
Arrangement.Bottom -> {
|
Arrangement.Bottom -> {
|
||||||
val paddingFromBottom = (constraints.maxHeight - (actionIconsPlaceable.height - titleBaseline)) / 2
|
val padding = (maxLayoutHeight - actionIconsPlaceable.height) / 2
|
||||||
|
val paddingFromBottom = padding - (actionIconsPlaceable.height - titleBaseline)
|
||||||
val heightWithPadding = paddingFromBottom + actionIconsPlaceable.height
|
val heightWithPadding = paddingFromBottom + actionIconsPlaceable.height
|
||||||
val adjustedBottomPadding =
|
val adjustedBottomPadding =
|
||||||
if (heightWithPadding > constraints.maxHeight) {
|
if (heightWithPadding > maxLayoutHeight) {
|
||||||
paddingFromBottom -
|
paddingFromBottom -
|
||||||
(heightWithPadding - constraints.maxHeight)
|
(heightWithPadding - maxLayoutHeight)
|
||||||
} else {
|
} else {
|
||||||
paddingFromBottom
|
paddingFromBottom
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue