Implemented setting option's text color

This commit is contained in:
dankito 2024-09-05 03:47:00 +02:00
parent 3de7e8f473
commit 66bb794afd
3 changed files with 9 additions and 7 deletions

View File

@ -116,7 +116,7 @@ fun SideMenu(appContent: @Composable () -> Unit) {
Divider(color = Colors.DrawerDivider)
Column(Modifier.padding(16.dp)) {
UiSettings(Modifier.fillMaxWidth().padding(bottom = VerticalSpacing))
UiSettings(Modifier.fillMaxWidth().padding(bottom = VerticalSpacing), textColor)
NavigationMenuItem(itemModifier, "Daten exportieren", textColor, horizontalPadding = ItemHorizontalPadding, icon = { Icon(Icons.AutoMirrored.Filled.Send, "Konto hinzufügen", Modifier.size(iconSize)) }) {
coroutineScope.launch {

View File

@ -5,11 +5,12 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import net.codinux.banking.ui.config.DI
import net.codinux.banking.ui.forms.BooleanOption
@Composable
fun UiSettings(modifier: Modifier) {
fun UiSettings(modifier: Modifier, textColor: Color = Color.Unspecified) {
val uiSettings = DI.uiSettings
val groupTransactions by uiSettings.groupTransactions.collectAsState()
@ -20,11 +21,11 @@ fun UiSettings(modifier: Modifier) {
Column(modifier) {
BooleanOption("Umsätze gruppieren", groupTransactions) { uiSettings.groupTransactions.value = it }
BooleanOption("Umsätze gruppieren", groupTransactions, textColor = textColor) { uiSettings.groupTransactions.value = it }
BooleanOption("Zebra Stripes", zebraStripes) { uiSettings.zebraStripes.value = it }
BooleanOption("Zebra Stripes", zebraStripes, textColor = textColor) { uiSettings.zebraStripes.value = it }
BooleanOption("Bank Icons anzeigen", showBankIcons) { uiSettings.showBankIcons.value = it }
BooleanOption("Bank Icons anzeigen", showBankIcons, textColor = textColor) { uiSettings.showBankIcons.value = it }
}
}

View File

@ -10,16 +10,17 @@ import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import net.codinux.banking.ui.config.Colors
@Composable
fun BooleanOption(label: String, isChecked: Boolean, enabled: Boolean = true, checkChanged: (Boolean) -> Unit) {
fun BooleanOption(label: String, isChecked: Boolean, enabled: Boolean = true, textColor: Color = Color.Unspecified, checkChanged: (Boolean) -> Unit) {
Row(verticalAlignment = Alignment.CenterVertically) {
Switch(checked = isChecked, onCheckedChange = checkChanged, enabled = enabled, colors = SwitchDefaults.colors(checkedThumbColor = Colors.CodinuxSecondaryColor))
Text(label, Modifier.fillMaxWidth().clickable { checkChanged(!!!isChecked) }.padding(start = 6.dp))
Text(label, Modifier.fillMaxWidth().clickable { checkChanged(!!!isChecked) }.padding(start = 6.dp), color = textColor)
}
}