Skip to content

Commit

Permalink
chore(ImportFileScreen): Enable the transferOptionTypes list to reach…
Browse files Browse the repository at this point in the history
… the screen's edges

Rework the paddings
  • Loading branch information
FabianDevel committed Nov 28, 2024
1 parent 639f135 commit 7c7a33d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,22 +189,29 @@ private fun ImportFilesScreen(
content = {
Column(
modifier = Modifier
.padding(horizontal = Margin.Medium, vertical = Margin.Large)
.padding(vertical = Margin.Large)
.verticalScroll(rememberScrollState()),
) {
ImportFilesTitle(titleRes = R.string.myFilesTitle)
ImportFilesTitle(modifier = Modifier.padding(horizontal = Margin.Medium), titleRes = R.string.myFilesTitle)
ImportedFilesCard(
modifier = Modifier.padding(vertical = Margin.Medium),
modifier = Modifier.padding(Margin.Medium),
files = files,
humanReadableSize = { humanReadableSize },
pickFiles = ::pickFiles,
removeFileByUid = removeFileByUid,
)
ImportTextFields(transferMessage, selectedTransferType.get)
ImportFilesTitle(Modifier.padding(vertical = Margin.Medium), titleRes = R.string.transferTypeTitle)
ImportTextFields(
modifier = Modifier
.padding(horizontal = Margin.Medium)
.fillMaxWidth(),
transferMessage = transferMessage,
selectedTransferType = selectedTransferType.get,
)
ImportFilesTitle(Modifier.padding(Margin.Medium), titleRes = R.string.transferTypeTitle)
TransferTypeButtons(selectedTransferType)
ImportFilesTitle(Modifier.padding(vertical = Margin.Medium), titleRes = R.string.advancedSettingsTitle)
ImportFilesTitle(Modifier.padding(Margin.Medium), titleRes = R.string.advancedSettingsTitle)
TransferOptionsTypes(
modifier = Modifier.padding(horizontal = Margin.Medium),
transferOptionsStates = transferOptionsCallbacks.transferOptionsStates,
onClick = { selectedOptionType -> showTransferOption = selectedOptionType },
)
Expand All @@ -216,12 +223,16 @@ private fun ImportFilesScreen(
}

@Composable
private fun ColumnScope.ImportTextFields(transferMessage: GetSetCallbacks<String>, selectedTransferType: () -> TransferTypeUi) {
private fun ColumnScope.ImportTextFields(
modifier: Modifier,
transferMessage: GetSetCallbacks<String>,
selectedTransferType: () -> TransferTypeUi,
) {

EmailAddressesTextFields(selectedTransferType)
EmailAddressesTextFields(modifier, selectedTransferType)

SwissTransferTextField(
modifier = Modifier.fillMaxWidth(),
modifier = modifier,
label = stringResource(R.string.transferMessagePlaceholder),
isRequired = false,
minLineNumber = 3,
Expand All @@ -230,21 +241,15 @@ private fun ColumnScope.ImportTextFields(transferMessage: GetSetCallbacks<String
}

@Composable
private fun ColumnScope.EmailAddressesTextFields(selectedTransferType: () -> TransferTypeUi) {
private fun ColumnScope.EmailAddressesTextFields(modifier: Modifier, selectedTransferType: () -> TransferTypeUi) {

val shouldShowEmailAddressesFields by remember { derivedStateOf { selectedTransferType() == TransferTypeUi.MAIL } }

AnimatedVisibility(visible = shouldShowEmailAddressesFields) {
Column {
SwissTransferTextField(
modifier = Modifier.fillMaxWidth(),
label = stringResource(R.string.transferSenderAddressPlaceholder),
)
SwissTransferTextField(modifier = modifier, label = stringResource(R.string.transferSenderAddressPlaceholder))
Spacer(Modifier.height(Margin.Medium))
SwissTransferTextField(
modifier = Modifier.fillMaxWidth(),
label = stringResource(R.string.transferRecipientAddressPlaceholder),
)
SwissTransferTextField(modifier = modifier, label = stringResource(R.string.transferRecipientAddressPlaceholder))
Spacer(Modifier.height(Margin.Medium))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ import androidx.annotation.StringRes
import androidx.compose.foundation.horizontalScroll
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.dp
import com.infomaniak.multiplatform_swisstransfer.common.models.TransferType
import com.infomaniak.swisstransfer.R
import com.infomaniak.swisstransfer.ui.images.AppImages.AppIcons
Expand All @@ -42,7 +45,9 @@ import com.infomaniak.swisstransfer.ui.utils.PreviewLightAndDark
@Composable
fun TransferTypeButtons(transferType: GetSetCallbacks<TransferTypeUi>) {
Row(
modifier = Modifier.horizontalScroll(rememberScrollState()),
modifier = Modifier
.horizontalScroll(rememberScrollState())
.windowInsetsPadding(insets = WindowInsets(left = Margin.Medium, top = 0.dp, right = Margin.Medium, bottom = 0.dp)),
horizontalArrangement = Arrangement.spacedBy(Margin.Mini),
) {
for (transferTypeEntry in TransferTypeUi.entries) {
Expand Down

0 comments on commit 7c7a33d

Please sign in to comment.