From 7c7a33d8b998696a65d6bc6bb1ec94438b5702ce Mon Sep 17 00:00:00 2001 From: Fabian Devel Date: Tue, 26 Nov 2024 13:03:35 +0100 Subject: [PATCH] chore(ImportFileScreen): Enable the transferOptionTypes list to reach the screen's edges Rework the paddings --- .../importfiles/ImportFilesScreen.kt | 41 +++++++++++-------- .../components/TransferTypeButtons.kt | 7 +++- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/ImportFilesScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/ImportFilesScreen.kt index b5a8eb95c..58d5d05d6 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/ImportFilesScreen.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/ImportFilesScreen.kt @@ -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 }, ) @@ -216,12 +223,16 @@ private fun ImportFilesScreen( } @Composable -private fun ColumnScope.ImportTextFields(transferMessage: GetSetCallbacks, selectedTransferType: () -> TransferTypeUi) { +private fun ColumnScope.ImportTextFields( + modifier: Modifier, + transferMessage: GetSetCallbacks, + selectedTransferType: () -> TransferTypeUi, +) { - EmailAddressesTextFields(selectedTransferType) + EmailAddressesTextFields(modifier, selectedTransferType) SwissTransferTextField( - modifier = Modifier.fillMaxWidth(), + modifier = modifier, label = stringResource(R.string.transferMessagePlaceholder), isRequired = false, minLineNumber = 3, @@ -230,21 +241,15 @@ private fun ColumnScope.ImportTextFields(transferMessage: GetSetCallbacks 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)) } } diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/components/TransferTypeButtons.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/components/TransferTypeButtons.kt index e32851f3a..92cf1f63a 100644 --- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/components/TransferTypeButtons.kt +++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/components/TransferTypeButtons.kt @@ -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 @@ -42,7 +45,9 @@ import com.infomaniak.swisstransfer.ui.utils.PreviewLightAndDark @Composable fun TransferTypeButtons(transferType: GetSetCallbacks) { 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) {