Compare commits

..

2 Commits

Author SHA1 Message Date
Rafal Wisniewski
38f3760cef fix: math on add expense screen 2026-05-04 21:57:23 +02:00
Rafal Wisniewski
9225f2275f fix: adjust style of delete confirmation dialog 2026-05-04 21:42:55 +02:00
3 changed files with 33 additions and 25 deletions

View File

@@ -115,10 +115,6 @@ fun AddExpenseBottomSheet(
) {
val currentTripId = currentTrip.id
// if (categories.isEmpty()) {
// return
// }
var amount by remember {
mutableStateOf(
"%.2f".format(expenseDtoToEdit?.expense?.amount ?: 0.00)
@@ -139,7 +135,7 @@ fun AddExpenseBottomSheet(
)
}
var category by remember {
mutableStateOf<Category?>(
mutableStateOf(
expenseDtoToEdit?.category ?: if (categories.isEmpty()) null else categories[0]
)
}
@@ -484,12 +480,20 @@ fun NumberKeyboard(
modifier = Modifier
.weight(1f),
containerColor = Color.Transparent,
onLongClick = onLongBackspaceClick
onLongClick = onLongBackspaceClick,
contentColor = MaterialTheme.colorScheme.onPrimaryContainer
)
"+", "÷", "", "×" -> KeyboardButton(
text = key,
onClick = { onOperatorClick(key) },
onClick = {
when (key) {
"+" -> onOperatorClick("+")
"÷" -> onOperatorClick("/")
"" -> onOperatorClick("-")
"×" -> onOperatorClick("*")
}
},
modifier = Modifier.weight(1f),
containerColor = MaterialTheme.colorScheme.tertiaryContainer,
contentColor = MaterialTheme.colorScheme.onTertiaryContainer
@@ -500,7 +504,7 @@ fun NumberKeyboard(
onClick = { onNumberClick(key) },
modifier = Modifier.weight(1f),
containerColor = Color.Transparent,
contentColor = MaterialTheme.colorScheme.onSecondary
contentColor = MaterialTheme.colorScheme.onPrimaryContainer
)
}
}
@@ -532,7 +536,8 @@ fun KeyboardButton(
when {
text != null -> Text(
text = text,
style = MaterialTheme.typography.headlineMedium
style = MaterialTheme.typography.headlineMedium,
color = contentColor
)
icon != null -> Icon(painter = icon, contentDescription = null)

View File

@@ -4,7 +4,6 @@ import android.annotation.SuppressLint
import android.os.Build
import androidx.annotation.RequiresApi
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
@@ -22,6 +21,8 @@ import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material3.BasicAlertDialog
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.ElevatedCard
import androidx.compose.material3.ExperimentalMaterial3Api
@@ -400,20 +401,22 @@ fun DeleteConfirmationDialog(
.fillMaxWidth()
.padding(top = 24.dp)
) {
Text(
text = stringResource(string.cancel),
style = MaterialTheme.typography.titleMedium,
color = MaterialTheme.colorScheme.onSecondaryContainer,
modifier = Modifier
.padding(end = 24.dp)
.clickable { onCancel() }
)
Text(
text = stringResource(string.delete),
color = MaterialTheme.colorScheme.error,
style = MaterialTheme.typography.titleMedium,
modifier = Modifier.clickable { onConfirm() }
Button(
modifier = Modifier.padding(end = 20.dp),
onClick = onCancel
) {
Text(stringResource(string.cancel))
}
Button(
onClick = onConfirm,
colors = ButtonDefaults.buttonColors(
containerColor = MaterialTheme.colorScheme.error,
contentColor = MaterialTheme.colorScheme.onError
)
) {
Text(stringResource(string.delete))
}
}
}
}

View File

@@ -230,7 +230,7 @@ fun SwipeToDeleteExpenseCard(
Modifier
.clip(CardDefaults.elevatedShape)
.fillMaxSize()
.background(MaterialTheme.colorScheme.onError)
.background(MaterialTheme.colorScheme.errorContainer)
.padding(horizontal = 20.dp),
contentAlignment = Alignment.CenterEnd
) {