From 2f7c5175c5fef354fc1b230a95da359cda89f0bc Mon Sep 17 00:00:00 2001 From: Lorenzo Vainigli Date: Thu, 7 Sep 2023 21:41:57 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=94=20Alignment=20fix=20in=20bottom=20?= =?UTF-8?q?menu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../composable/activity/MainActivityLayout.kt | 55 ++++++++++--------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/app/src/main/java/com/lorenzovainigli/foodexpirationdates/view/composable/activity/MainActivityLayout.kt b/app/src/main/java/com/lorenzovainigli/foodexpirationdates/view/composable/activity/MainActivityLayout.kt index 9065d59e..45c2b74f 100644 --- a/app/src/main/java/com/lorenzovainigli/foodexpirationdates/view/composable/activity/MainActivityLayout.kt +++ b/app/src/main/java/com/lorenzovainigli/foodexpirationdates/view/composable/activity/MainActivityLayout.kt @@ -7,6 +7,8 @@ import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size @@ -135,35 +137,34 @@ fun MainActivityLayout( } ) if (!items.isNullOrEmpty()) { - NavigationBarItem( - selected = false, - onClick = {}, - icon = { - Button( - modifier = Modifier - .size(50.dp), - contentPadding = PaddingValues(0.dp), - onClick = { - context.startActivity( - Intent( - context, - InsertActivity::class.java - ) + Row( + modifier = Modifier.fillMaxHeight(), + verticalAlignment = Alignment.CenterVertically + ) { + Button( + modifier = Modifier + .size(56.dp), + contentPadding = PaddingValues(0.dp), + onClick = { + context.startActivity( + Intent( + context, + InsertActivity::class.java ) - }, - colors = ButtonDefaults.buttonColors( - containerColor = MaterialTheme.colorScheme.tertiary, - contentColor = MaterialTheme.colorScheme.onTertiary - ), - shape = CircleShape - ) { - Icon( - imageVector = Icons.Rounded.Add, - contentDescription = null ) - } + }, + colors = ButtonDefaults.buttonColors( + containerColor = MaterialTheme.colorScheme.tertiary, + contentColor = MaterialTheme.colorScheme.onTertiary + ), + shape = CircleShape + ) { + Icon( + imageVector = Icons.Rounded.Add, + contentDescription = null + ) } - ) + } } NavigationBarItem( selected = false, @@ -318,6 +319,8 @@ fun MainActivityLayoutPreview() { val items = getItemsForPreview(context) MainActivityLayout( items = items, + viewModel = null, + prefsViewModel = null, addExpirationDate = null, deleteExpirationDate = null )