diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/appskeleton/SideMenuContent.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/appskeleton/SideMenuContent.kt index 61d8a12..582e71e 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/appskeleton/SideMenuContent.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/appskeleton/SideMenuContent.kt @@ -25,7 +25,7 @@ import net.codinux.banking.ui.composables.settings.UiSettings import net.codinux.banking.ui.composables.text.ItemDivider import net.codinux.banking.ui.config.Colors import net.codinux.banking.ui.config.DI -import net.codinux.banking.ui.extensions.verticalScroll +import net.codinux.banking.ui.extensions.rememberVerticalScroll import org.jetbrains.compose.resources.imageResource private val uiState = DI.uiState @@ -60,7 +60,7 @@ fun SideMenuContent() { val coroutineScope = rememberCoroutineScope() - Column(Modifier.fillMaxSize().background(Colors.DrawerContentBackground).verticalScroll()) { + Column(Modifier.fillMaxSize().background(Colors.DrawerContentBackground).rememberVerticalScroll()) { Column(Modifier.fillMaxWidth().height(HeaderHeight.dp).background(HeaderBackground).padding(16.dp)) { Spacer(Modifier.weight(1f)) diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/extensions/ModifierExtensions.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/extensions/ModifierExtensions.kt index 11adf86..e5fbf7d 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/extensions/ModifierExtensions.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/extensions/ModifierExtensions.kt @@ -1,9 +1,7 @@ package net.codinux.banking.ui.extensions -import androidx.compose.foundation.ScrollState -import androidx.compose.foundation.horizontalScroll +import androidx.compose.foundation.* import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.verticalScroll import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.unit.Dp @@ -14,8 +12,14 @@ import net.codinux.log.Log fun Modifier.verticalScroll() = this.verticalScroll(ScrollState(0), enabled = true) +@Composable +fun Modifier.rememberVerticalScroll() = this.verticalScroll(rememberScrollState()) + fun Modifier.horizontalScroll() = this.horizontalScroll(ScrollState(0), enabled = true) +@Composable +fun Modifier.rememberHorizontalScroll() = this.horizontalScroll(rememberScrollState()) + @Composable // we need to support three different cases: diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/screens/AccountTransactionDetailsScreen.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/screens/AccountTransactionDetailsScreen.kt index c517d1a..9fba64b 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/screens/AccountTransactionDetailsScreen.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/screens/AccountTransactionDetailsScreen.kt @@ -1,9 +1,7 @@ package net.codinux.banking.ui.screens import androidx.compose.foundation.layout.* -import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.text.selection.SelectionContainer -import androidx.compose.foundation.verticalScroll import androidx.compose.material.Text import androidx.compose.runtime.* import androidx.compose.ui.Modifier @@ -12,7 +10,7 @@ import kotlinx.coroutines.launch import net.codinux.banking.client.model.isNegative import net.codinux.banking.persistence.entities.AccountTransactionEntity import net.codinux.banking.ui.config.DI -import net.codinux.banking.ui.extensions.verticalScroll +import net.codinux.banking.ui.extensions.rememberVerticalScroll import net.codinux.banking.ui.forms.LabelledValue import net.codinux.banking.ui.forms.OutlinedTextField import net.codinux.banking.ui.forms.SectionHeader @@ -72,7 +70,7 @@ fun AccountTransactionDetailsScreen(transaction: AccountTransactionEntity, onClo onClosed = onClosed ) { SelectionContainer { - Column(Modifier.fillMaxSize().verticalScroll(rememberScrollState())) { + Column(Modifier.fillMaxSize().rememberVerticalScroll()) { Column(Modifier.fillMaxWidth()) { SectionHeader(if (isExpense) "Empfänger*in" else "Zahlende*r", false) diff --git a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/screens/CreateEpcQrCodeScreen.kt b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/screens/CreateEpcQrCodeScreen.kt index b927a0e..399968d 100644 --- a/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/screens/CreateEpcQrCodeScreen.kt +++ b/composeApp/src/commonMain/kotlin/net/codinux/banking/ui/screens/CreateEpcQrCodeScreen.kt @@ -2,9 +2,7 @@ package net.codinux.banking.ui.screens import androidx.compose.foundation.Image import androidx.compose.foundation.layout.* -import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.text.KeyboardOptions -import androidx.compose.foundation.verticalScroll import androidx.compose.material.MaterialTheme import androidx.compose.material.Text import androidx.compose.runtime.* @@ -21,6 +19,7 @@ import net.codinux.banking.ui.composables.tan.ImageSizeControls import net.codinux.banking.ui.config.Colors import net.codinux.banking.ui.config.DI import net.codinux.banking.ui.extensions.ImeNext +import net.codinux.banking.ui.extensions.rememberVerticalScroll import net.codinux.banking.ui.forms.CaptionText import net.codinux.banking.ui.forms.OutlinedTextField import net.codinux.banking.ui.forms.Select @@ -88,7 +87,7 @@ fun CreateEpcQrCodeScreen(onClosed: () -> Unit) { FullscreenViewBase("EPC QR Code erstellen", "Schließen", onClosed = onClosed) { - Column(Modifier.fillMaxWidth().verticalScroll(rememberScrollState())) { + Column(Modifier.fillMaxWidth().rememberVerticalScroll()) { if (epcQrCodeGeneratingError != null) { Text("QR Code konnte nicht erstellt werden:${NewLine}$epcQrCodeGeneratingError", color = MaterialTheme.colors.error, modifier = Modifier.padding(vertical = 8.dp)) } else if (epcQrCodeBytes == null) {