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

View file

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

View file

@ -1,8 +1,6 @@
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.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
@ -32,12 +30,10 @@ fun VaultContent(
identityGroupClick: () -> Unit,
secureNoteGroupClick: () -> Unit,
trashClick: () -> Unit,
paddingValues: PaddingValues,
modifier: Modifier = Modifier,
) {
LazyColumn(
modifier = Modifier
.fillMaxSize()
.padding(paddingValues),
modifier = modifier,
) {
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.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.runtime.Composable
import androidx.compose.ui.Alignment
@ -14,11 +11,9 @@ import androidx.compose.ui.Modifier
* Loading view for the [VaultScreen].
*/
@Composable
fun VaultLoading(paddingValues: PaddingValues) {
fun VaultLoading(modifier: Modifier = Modifier) {
Column(
modifier = Modifier
.fillMaxSize()
.padding(paddingValues),
modifier = modifier,
verticalArrangement = Arrangement.Center,
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.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
@ -25,13 +23,11 @@ import com.x8bit.bitwarden.R
*/
@Composable
fun VaultNoItems(
paddingValues: PaddingValues,
addItemClickAction: () -> Unit,
modifier: Modifier = Modifier,
) {
Column(
modifier = Modifier
.fillMaxSize()
.padding(paddingValues),
modifier = modifier,
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally,
) {

View file

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