Skip to content

Commit

Permalink
fix update on dismiss
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabtron committed Jan 31, 2024
1 parent f3b97e2 commit 6f7ae52
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ fun AccountDetails(
val showDeleteDialog = remember { mutableStateOf(false) }
SnabblePayTheme {
AppBarLayout(
title = cardName.value,
title = accountCard.name,
onBackClick = {
navigator?.navigate(HomeScreenDestination)
}
Expand All @@ -82,10 +82,11 @@ fun AccountDetails(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp),
value = cardName.value,
value = accountCard.name,
onValueChange = { cardName.value = it },
onAction = {
onLabelChange(cardName.value, accountCard.cardBackgroundColor)
cardName.value = it
onLabelChange(it, accountCard.cardBackgroundColor)
showChangeTitleDialog.value = false
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import androidx.compose.material3.DividerDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color.Companion.Transparent
import androidx.compose.ui.text.font.FontWeight
Expand All @@ -25,12 +29,15 @@ fun EditTextFieldCentered(
modifier: Modifier = Modifier,
value: String = "",
onValueChange: (String) -> Unit,
onAction: () -> Unit,
onAction: (String) -> Unit,
) {
val customTextSelectionColors = TextSelectionColors(
handleColor = MaterialTheme.colorScheme.onSurface,
backgroundColor = Transparent
)

var inputValue by remember { mutableStateOf(value) }

CompositionLocalProvider(
LocalTextSelectionColors provides customTextSelectionColors
) {
Expand All @@ -49,13 +56,12 @@ fun EditTextFieldCentered(
imeAction = ImeAction.Done
),
keyboardActions = KeyboardActions(
onDone = {
onAction()
}
onDone = { onAction(inputValue) }
),
value = value,
value = inputValue,
onValueChange = {
onValueChange(it)
inputValue = it
},
maxLines = 1,
textStyle = MaterialTheme.typography.titleMedium.copy(
Expand Down

0 comments on commit 6f7ae52

Please sign in to comment.