Skip to content

Commit 407cbcb

Browse files
authored
Merge pull request #617 from Amsterdam-Team/fix/movie-details-app-bar-padding
refactor: Center title in DefaultAppBar
2 parents a4bd784 + b9a6fc2 commit 407cbcb

1 file changed

Lines changed: 24 additions & 7 deletions

File tree

ui/src/main/java/com/amsterdam/ui/components/appBar/DefaultAppBar.kt

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package com.amsterdam.ui.components.appBar
22

3+
import androidx.compose.foundation.layout.Box
34
import androidx.compose.foundation.layout.PaddingValues
5+
import androidx.compose.foundation.layout.height
46
import androidx.compose.runtime.Composable
7+
import androidx.compose.ui.Alignment
58
import androidx.compose.ui.Modifier
69
import androidx.compose.ui.graphics.Color
710
import androidx.compose.ui.graphics.painter.Painter
@@ -41,13 +44,15 @@ fun DefaultAppBar(
4144
title =
4245
title.takeIf { it.isNotBlank() }?.let { text ->
4346
{
44-
Text(
45-
text = text,
46-
color = AppTheme.color.title,
47-
style = AppTheme.textStyle.title.large,
48-
maxLines = 1,
49-
overflow = TextOverflow.Ellipsis
50-
)
47+
Box(Modifier.height(40.dp), contentAlignment = Alignment.Center) {
48+
Text(
49+
text = text,
50+
color = AppTheme.color.title,
51+
style = AppTheme.textStyle.title.large,
52+
maxLines = 1,
53+
overflow = TextOverflow.Ellipsis
54+
)
55+
}
5156
}
5257
},
5358
leadingIcon =
@@ -102,3 +107,15 @@ private fun DefaultAppBarPreview() {
102107
)
103108
}
104109
}
110+
111+
@ThemeAndLocalePreviews
112+
@Composable
113+
private fun DefaultAppBaarPreview() {
114+
AflamiTheme {
115+
DefaultAppBar(
116+
title = stringResource(R.string.my_account),
117+
containerColor = AppTheme.color.surface,
118+
showNavigateBackButton = false
119+
)
120+
}
121+
}

0 commit comments

Comments
 (0)