fix(ui): align article title with the first search result in two panes
In landscape the detail pane rendered the title inside a fixed 56.dp bar and centered the text in it, so the headword sat about 14 dp lower than the first search result next to it. Add a compact variant of the title bar without the fixed height; the title line now shares the top offset of the first list row.
This commit is contained in:
1 parent
4e42a269a7
commit
ee19f84f91
2 files changed
+11
-4
No files matched your search
@@ -211,7 +211,8 @@ fun ArticleTitleBar(
|
|||||||
articleState: ArticleState?,
|
articleState: ArticleState?,
|
||||||
showBackButton: Boolean,
|
showBackButton: Boolean,
|
||||||
onNavigateBack: () -> Unit,
|
onNavigateBack: () -> Unit,
|
||||||
modifier: Modifier = Modifier
|
modifier: Modifier = Modifier,
|
||||||
|
compact: Boolean = false,
|
||||||
) {
|
) {
|
||||||
val title = when (articleState) {
|
val title = when (articleState) {
|
||||||
is ArticleState.Loading -> articleState.title
|
is ArticleState.Loading -> articleState.title
|
||||||
@@ -230,9 +231,14 @@ fun ArticleTitleBar(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.windowInsetsPadding(AppWindowInsets.topAndHorizontalSafeDrawing)
|
.windowInsetsPadding(AppWindowInsets.topAndHorizontalSafeDrawing)
|
||||||
.padding(
|
.then(
|
||||||
top = Spacing.listItemVertical,
|
if (compact) {
|
||||||
bottom = Spacing.listItemVertical
|
Modifier.padding(vertical = Spacing.listItemVertical)
|
||||||
|
} else {
|
||||||
|
Modifier
|
||||||
|
.padding(top = Spacing.topBarPadding, bottom = Spacing.topBarPadding)
|
||||||
|
.height(Spacing.topBarHeight)
|
||||||
|
}
|
||||||
),
|
),
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ fun AdaptiveMainScreen(
|
|||||||
articleState = articleState,
|
articleState = articleState,
|
||||||
showBackButton = isShowingDetail && articleState != null,
|
showBackButton = isShowingDetail && articleState != null,
|
||||||
onNavigateBack = onNavigateBackFromArticle,
|
onNavigateBack = onNavigateBackFromArticle,
|
||||||
|
compact = true,
|
||||||
modifier = Modifier.windowInsetsPadding(
|
modifier = Modifier.windowInsetsPadding(
|
||||||
WindowInsets.safeDrawing.only(WindowInsetsSides.Top)
|
WindowInsets.safeDrawing.only(WindowInsetsSides.Top)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in new issue
Block a user