Fix SettingsScreen.kt

This commit is contained in:
2026-04-20 14:04:44 +02:00
parent d6e0b5c3bb
commit 15017ba400
6 changed files with 103 additions and 35 deletions

View File

@@ -15,13 +15,13 @@ import androidx.compose.material3.RadioButton
import androidx.compose.material3.Text
import androidx.compose.material3.TextField
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.unit.dp
@@ -46,6 +46,41 @@ fun SettingsScreen(
val timingOptions = remember { TimingOption.entries }
var selectedTiming by remember { mutableStateOf(TimingOption.Absolute) }
var text1 by remember { mutableStateOf("") }
var text2 by remember { mutableStateOf("") }
var show1 by remember { mutableStateOf(false) }
var show2 by remember { mutableStateOf(false) }
LaunchedEffect(selectedTiming) {
when (selectedTiming) {
TimingOption.Absolute -> {}
TimingOption.Fischer -> {
text1 = "Increment"
show1 = true
byoM = "0"
byoSe = "10"
}
TimingOption.Canadian -> {
text1 = "byo-yomi time"
text2 = "byo-yomi stones"
show1 = true
show2 = true
byoM = "10"
byoSe = "0"
byoSt = "25"
}
TimingOption.Japan -> {
text1 = "byo-yomi time"
text2 = "byo-yomi periods"
show1 = true
show2 = true
byoM = "1"
byoSe = "0"
byoSt = "3"
}
}
}
Column(
modifier = modifier.fillMaxSize(),
verticalArrangement = Arrangement.Center,
@@ -85,39 +120,6 @@ fun SettingsScreen(
}
}
var text1 = ""
var text2 = ""
var show1 = false
var show2 = false
when (selectedTiming) {
TimingOption.Absolute -> {}
TimingOption.Fischer -> {
text1 = "Increment"
show1 = true
byoM = "0"
byoSe = "10"
}
TimingOption.Canadian -> {
text1 = "byo-yomi time"
text2 = "byo-yomi stones"
show1 = true
show2 = true
byoM = "10"
byoSe = "0"
byoSt = "25"
}
TimingOption.Japan -> {
text1 = "byo-yomi time"
text2 = "byo-yomi periods"
show1 = true
show2 = true
byoM = "1"
byoSe = "0"
byoSt = "3"
}
}
if (show1) {
Spacer(modifier = Modifier.height(8.dp))