From 1fcdd3fb19e7cc1fb2fe4e64bb6415a941e8fb58 Mon Sep 17 00:00:00 2001 From: Xavier Molloy Date: Fri, 15 Sep 2023 11:55:35 +0200 Subject: [PATCH] Change switch to specific screen and remove unnecessary subtitle --- common/src/commonMain/kotlin/org/hisp/dhis/common/App.kt | 6 +++--- .../kotlin/org/hisp/dhis/common/screens/Components.kt | 2 +- .../screens/{InputYesOnlyScreen.kt => SwitchScreen.kt} | 4 +--- 3 files changed, 5 insertions(+), 7 deletions(-) rename common/src/commonMain/kotlin/org/hisp/dhis/common/screens/{InputYesOnlyScreen.kt => SwitchScreen.kt} (95%) diff --git a/common/src/commonMain/kotlin/org/hisp/dhis/common/App.kt b/common/src/commonMain/kotlin/org/hisp/dhis/common/App.kt index d61649697..4c4fc1046 100644 --- a/common/src/commonMain/kotlin/org/hisp/dhis/common/App.kt +++ b/common/src/commonMain/kotlin/org/hisp/dhis/common/App.kt @@ -41,13 +41,13 @@ import org.hisp.dhis.common.screens.InputPositiveIntegerScreen import org.hisp.dhis.common.screens.InputRadioButtonScreen import org.hisp.dhis.common.screens.InputScreen import org.hisp.dhis.common.screens.InputTextScreen -import org.hisp.dhis.common.screens.InputYesOnlyScreen import org.hisp.dhis.common.screens.LegendDescriptionScreen import org.hisp.dhis.common.screens.LegendScreen import org.hisp.dhis.common.screens.ProgressScreen import org.hisp.dhis.common.screens.RadioButtonScreen import org.hisp.dhis.common.screens.SectionScreen import org.hisp.dhis.common.screens.SupportingTextScreen +import org.hisp.dhis.common.screens.SwitchScreen import org.hisp.dhis.common.screens.TagsScreen import org.hisp.dhis.mobile.ui.designsystem.theme.DHIS2Theme import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing @@ -61,7 +61,7 @@ fun App() { @Composable fun Main() { - val currentScreen = remember { mutableStateOf(Components.FORM_SHELLS) } + val currentScreen = remember { mutableStateOf(Components.SWITCH) } var expanded by remember { mutableStateOf(false) } Column( @@ -133,8 +133,8 @@ fun Main() { Components.INPUT_INTEGER -> InputIntegerScreen() Components.INPUT_NUMBER -> InputNumberScreen() Components.INPUT_LETTER -> InputLetterScreen() + Components.SWITCH -> SwitchScreen() Components.INPUT_RADIO_BUTTON -> InputRadioButtonScreen() - Components.INPUT_YES_ONLY -> InputYesOnlyScreen() } } } diff --git a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/Components.kt b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/Components.kt index 9915cc8bc..e2a7f4a24 100644 --- a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/Components.kt +++ b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/Components.kt @@ -27,5 +27,5 @@ enum class Components(val label: String) { BUTTON_BLOCK("Button block"), ICON_CARDS("Icon Cards"), INPUT_RADIO_BUTTON("Input Radio Button"), - INPUT_YES_ONLY("Input Yes Only"), + SWITCH("Switch"), } diff --git a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/InputYesOnlyScreen.kt b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/SwitchScreen.kt similarity index 95% rename from common/src/commonMain/kotlin/org/hisp/dhis/common/screens/InputYesOnlyScreen.kt rename to common/src/commonMain/kotlin/org/hisp/dhis/common/screens/SwitchScreen.kt index f148f6bba..d76bf7860 100644 --- a/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/InputYesOnlyScreen.kt +++ b/common/src/commonMain/kotlin/org/hisp/dhis/common/screens/SwitchScreen.kt @@ -16,7 +16,7 @@ import org.hisp.dhis.mobile.ui.designsystem.component.Title import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing @Composable -fun InputYesOnlyScreen() { +fun SwitchScreen() { ColumnComponentContainer { Title("Switches") SubTitle("Toggled enabled and disabled switch") @@ -25,8 +25,6 @@ fun InputYesOnlyScreen() { var switchThree by remember { mutableStateOf(false) } var switchFour by remember { mutableStateOf(false) } - SubTitle("Toggled enabled and disabled switch") - RowComponentContainer { Switch(isChecked = switchOne, onCheckedChange = { switchOne = !it }) Switch(isChecked = switchTwo, onCheckedChange = { switchTwo = !it }, enabled = false)