From adaaa153b667a790a9400ff93d53f0b3231a7070 Mon Sep 17 00:00:00 2001 From: Sahil Khan <85223122+sahilsk3333@users.noreply.github.com> Date: Wed, 15 Nov 2023 17:24:15 +0530 Subject: [PATCH] Replaced TopAppBar with CenterAlignedTopAppBar, Fix issue #857 App title moves --- .../google/samples/apps/sunflower/compose/home/HomeScreen.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/google/samples/apps/sunflower/compose/home/HomeScreen.kt b/app/src/main/java/com/google/samples/apps/sunflower/compose/home/HomeScreen.kt index d7b6400e2..5b274d74a 100644 --- a/app/src/main/java/com/google/samples/apps/sunflower/compose/home/HomeScreen.kt +++ b/app/src/main/java/com/google/samples/apps/sunflower/compose/home/HomeScreen.kt @@ -30,6 +30,7 @@ import androidx.compose.foundation.layout.statusBarsPadding import androidx.compose.foundation.pager.HorizontalPager import androidx.compose.foundation.pager.PagerState import androidx.compose.foundation.pager.rememberPagerState +import androidx.compose.material3.CenterAlignedTopAppBar import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.IconButton @@ -38,7 +39,6 @@ import androidx.compose.material3.Scaffold import androidx.compose.material3.Tab import androidx.compose.material3.TabRow import androidx.compose.material3.Text -import androidx.compose.material3.TopAppBar import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.TopAppBarScrollBehavior import androidx.compose.runtime.Composable @@ -169,7 +169,7 @@ private fun HomeTopAppBar( scrollBehavior: TopAppBarScrollBehavior, modifier: Modifier = Modifier ) { - TopAppBar( + CenterAlignedTopAppBar( title = { Row( Modifier.fillMaxWidth(),