Fixed remembering vertical scroll state
This commit is contained in:
parent
1c7fa49de5
commit
43f15fa662
|
@ -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.composables.text.ItemDivider
|
||||||
import net.codinux.banking.ui.config.Colors
|
import net.codinux.banking.ui.config.Colors
|
||||||
import net.codinux.banking.ui.config.DI
|
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
|
import org.jetbrains.compose.resources.imageResource
|
||||||
|
|
||||||
private val uiState = DI.uiState
|
private val uiState = DI.uiState
|
||||||
|
@ -60,7 +60,7 @@ fun SideMenuContent() {
|
||||||
|
|
||||||
val coroutineScope = rememberCoroutineScope()
|
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)) {
|
Column(Modifier.fillMaxWidth().height(HeaderHeight.dp).background(HeaderBackground).padding(16.dp)) {
|
||||||
Spacer(Modifier.weight(1f))
|
Spacer(Modifier.weight(1f))
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
package net.codinux.banking.ui.extensions
|
package net.codinux.banking.ui.extensions
|
||||||
|
|
||||||
import androidx.compose.foundation.ScrollState
|
import androidx.compose.foundation.*
|
||||||
import androidx.compose.foundation.horizontalScroll
|
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.verticalScroll
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.unit.Dp
|
import androidx.compose.ui.unit.Dp
|
||||||
|
@ -14,8 +12,14 @@ import net.codinux.log.Log
|
||||||
|
|
||||||
fun Modifier.verticalScroll() = this.verticalScroll(ScrollState(0), enabled = true)
|
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)
|
fun Modifier.horizontalScroll() = this.horizontalScroll(ScrollState(0), enabled = true)
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun Modifier.rememberHorizontalScroll() = this.horizontalScroll(rememberScrollState())
|
||||||
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
// we need to support three different cases:
|
// we need to support three different cases:
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
package net.codinux.banking.ui.screens
|
package net.codinux.banking.ui.screens
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.foundation.rememberScrollState
|
|
||||||
import androidx.compose.foundation.text.selection.SelectionContainer
|
import androidx.compose.foundation.text.selection.SelectionContainer
|
||||||
import androidx.compose.foundation.verticalScroll
|
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material.Text
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
@ -12,7 +10,7 @@ import kotlinx.coroutines.launch
|
||||||
import net.codinux.banking.client.model.isNegative
|
import net.codinux.banking.client.model.isNegative
|
||||||
import net.codinux.banking.persistence.entities.AccountTransactionEntity
|
import net.codinux.banking.persistence.entities.AccountTransactionEntity
|
||||||
import net.codinux.banking.ui.config.DI
|
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.LabelledValue
|
||||||
import net.codinux.banking.ui.forms.OutlinedTextField
|
import net.codinux.banking.ui.forms.OutlinedTextField
|
||||||
import net.codinux.banking.ui.forms.SectionHeader
|
import net.codinux.banking.ui.forms.SectionHeader
|
||||||
|
@ -72,7 +70,7 @@ fun AccountTransactionDetailsScreen(transaction: AccountTransactionEntity, onClo
|
||||||
onClosed = onClosed
|
onClosed = onClosed
|
||||||
) {
|
) {
|
||||||
SelectionContainer {
|
SelectionContainer {
|
||||||
Column(Modifier.fillMaxSize().verticalScroll(rememberScrollState())) {
|
Column(Modifier.fillMaxSize().rememberVerticalScroll()) {
|
||||||
|
|
||||||
Column(Modifier.fillMaxWidth()) {
|
Column(Modifier.fillMaxWidth()) {
|
||||||
SectionHeader(if (isExpense) "Empfänger*in" else "Zahlende*r", false)
|
SectionHeader(if (isExpense) "Empfänger*in" else "Zahlende*r", false)
|
||||||
|
|
|
@ -2,9 +2,7 @@ package net.codinux.banking.ui.screens
|
||||||
|
|
||||||
import androidx.compose.foundation.Image
|
import androidx.compose.foundation.Image
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.foundation.rememberScrollState
|
|
||||||
import androidx.compose.foundation.text.KeyboardOptions
|
import androidx.compose.foundation.text.KeyboardOptions
|
||||||
import androidx.compose.foundation.verticalScroll
|
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material.MaterialTheme
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material.Text
|
||||||
import androidx.compose.runtime.*
|
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.Colors
|
||||||
import net.codinux.banking.ui.config.DI
|
import net.codinux.banking.ui.config.DI
|
||||||
import net.codinux.banking.ui.extensions.ImeNext
|
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.CaptionText
|
||||||
import net.codinux.banking.ui.forms.OutlinedTextField
|
import net.codinux.banking.ui.forms.OutlinedTextField
|
||||||
import net.codinux.banking.ui.forms.Select
|
import net.codinux.banking.ui.forms.Select
|
||||||
|
@ -88,7 +87,7 @@ fun CreateEpcQrCodeScreen(onClosed: () -> Unit) {
|
||||||
|
|
||||||
|
|
||||||
FullscreenViewBase("EPC QR Code erstellen", "Schließen", onClosed = onClosed) {
|
FullscreenViewBase("EPC QR Code erstellen", "Schließen", onClosed = onClosed) {
|
||||||
Column(Modifier.fillMaxWidth().verticalScroll(rememberScrollState())) {
|
Column(Modifier.fillMaxWidth().rememberVerticalScroll()) {
|
||||||
if (epcQrCodeGeneratingError != null) {
|
if (epcQrCodeGeneratingError != null) {
|
||||||
Text("QR Code konnte nicht erstellt werden:${NewLine}$epcQrCodeGeneratingError", color = MaterialTheme.colors.error, modifier = Modifier.padding(vertical = 8.dp))
|
Text("QR Code konnte nicht erstellt werden:${NewLine}$epcQrCodeGeneratingError", color = MaterialTheme.colors.error, modifier = Modifier.padding(vertical = 8.dp))
|
||||||
} else if (epcQrCodeBytes == null) {
|
} else if (epcQrCodeBytes == null) {
|
||||||
|
|
Loading…
Reference in New Issue