Removed padding values from constructors of composable functions (#366)

This commit is contained in:
Ramsey Smith 2023-12-11 13:24:46 -07:00 committed by Álison Fernandes
parent 1adf58aca8
commit 62ab43dfd5
6 changed files with 14 additions and 29 deletions

View file

@ -2,7 +2,6 @@ package com.x8bit.bitwarden.ui.vault.feature.itemlisting
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
@ -21,7 +20,6 @@ import com.x8bit.bitwarden.ui.vault.feature.vault.VaultNoItems
*/ */
@Composable @Composable
fun VaultItemListingEmpty( fun VaultItemListingEmpty(
paddingValues: PaddingValues,
itemListingType: VaultItemListingState.ItemListingType, itemListingType: VaultItemListingState.ItemListingType,
addItemClickAction: () -> Unit, addItemClickAction: () -> Unit,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
@ -43,7 +41,7 @@ fun VaultItemListingEmpty(
else -> { else -> {
VaultNoItems( VaultNoItems(
paddingValues = paddingValues, modifier = modifier,
addItemClickAction = addItemClickAction, addItemClickAction = addItemClickAction,
) )
} }

View file

@ -142,7 +142,6 @@ private fun VaultItemListingScaffold(
is VaultItemListingState.ViewState.NoItems -> { is VaultItemListingState.ViewState.NoItems -> {
VaultItemListingEmpty( VaultItemListingEmpty(
paddingValues = paddingValues,
itemListingType = state.itemListingType, itemListingType = state.itemListingType,
addItemClickAction = addVaultItemClick, addItemClickAction = addVaultItemClick,
modifier = modifier, modifier = modifier,

View file

@ -1,8 +1,6 @@
package com.x8bit.bitwarden.ui.vault.feature.vault package com.x8bit.bitwarden.ui.vault.feature.vault
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
@ -32,12 +30,10 @@ fun VaultContent(
identityGroupClick: () -> Unit, identityGroupClick: () -> Unit,
secureNoteGroupClick: () -> Unit, secureNoteGroupClick: () -> Unit,
trashClick: () -> Unit, trashClick: () -> Unit,
paddingValues: PaddingValues, modifier: Modifier = Modifier,
) { ) {
LazyColumn( LazyColumn(
modifier = Modifier modifier = modifier,
.fillMaxSize()
.padding(paddingValues),
) { ) {
if (state.favoriteItems.isNotEmpty()) { if (state.favoriteItems.isNotEmpty()) {

View file

@ -2,9 +2,6 @@ package com.x8bit.bitwarden.ui.vault.feature.vault
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
@ -14,11 +11,9 @@ import androidx.compose.ui.Modifier
* Loading view for the [VaultScreen]. * Loading view for the [VaultScreen].
*/ */
@Composable @Composable
fun VaultLoading(paddingValues: PaddingValues) { fun VaultLoading(modifier: Modifier = Modifier) {
Column( Column(
modifier = Modifier modifier = modifier,
.fillMaxSize()
.padding(paddingValues),
verticalArrangement = Arrangement.Center, verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
) { ) {

View file

@ -2,9 +2,7 @@ package com.x8bit.bitwarden.ui.vault.feature.vault
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
@ -25,13 +23,11 @@ import com.x8bit.bitwarden.R
*/ */
@Composable @Composable
fun VaultNoItems( fun VaultNoItems(
paddingValues: PaddingValues,
addItemClickAction: () -> Unit, addItemClickAction: () -> Unit,
modifier: Modifier = Modifier,
) { ) {
Column( Column(
modifier = Modifier modifier = modifier,
.fillMaxSize()
.padding(paddingValues),
verticalArrangement = Arrangement.Center, verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
) { ) {

View file

@ -200,6 +200,9 @@ private fun VaultScreenScaffold(
}, },
modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection), modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection),
) { paddingValues -> ) { paddingValues ->
val modifier = Modifier
.fillMaxSize()
.padding(paddingValues)
Box { Box {
when (val viewState = state.viewState) { when (val viewState = state.viewState) {
is VaultState.ViewState.Content -> VaultContent( is VaultState.ViewState.Content -> VaultContent(
@ -211,12 +214,12 @@ private fun VaultScreenScaffold(
identityGroupClick = identityGroupClick, identityGroupClick = identityGroupClick,
secureNoteGroupClick = secureNoteGroupClick, secureNoteGroupClick = secureNoteGroupClick,
trashClick = trashClick, trashClick = trashClick,
paddingValues = paddingValues, modifier = modifier,
) )
is VaultState.ViewState.Loading -> VaultLoading(paddingValues = paddingValues) is VaultState.ViewState.Loading -> VaultLoading(modifier = modifier)
is VaultState.ViewState.NoItems -> VaultNoItems( is VaultState.ViewState.NoItems -> VaultNoItems(
paddingValues = paddingValues, modifier = modifier,
addItemClickAction = addItemClickAction, addItemClickAction = addItemClickAction,
) )
} }
@ -231,9 +234,7 @@ private fun VaultScreenScaffold(
onAddAccountClick = addAccountClickAction, onAddAccountClick = addAccountClickAction,
onDismissRequest = { updateAccountMenuVisibility(false) }, onDismissRequest = { updateAccountMenuVisibility(false) },
topAppBarScrollBehavior = scrollBehavior, topAppBarScrollBehavior = scrollBehavior,
modifier = Modifier modifier = modifier,
.fillMaxSize()
.padding(paddingValues),
) )
} }
} }