Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANDROAPP-5721-mobile-ui-Supporting-text-visual-improvements-animations #166

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/src/commonMain/kotlin/org/hisp/dhis/common/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ fun App() {

@Composable
fun Main() {
val currentScreen = remember { mutableStateOf(Components.FULL_SCREEN_IMAGE) }
val currentScreen = remember { mutableStateOf(Components.INPUT_RADIO_BUTTON) }
var expanded by remember { mutableStateOf(false) }

Column(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import org.hisp.dhis.common.screens.previews.lorem
import org.hisp.dhis.mobile.ui.designsystem.component.Button
import org.hisp.dhis.mobile.ui.designsystem.component.ColumnComponentContainer
import org.hisp.dhis.mobile.ui.designsystem.component.InputRadioButton
import org.hisp.dhis.mobile.ui.designsystem.component.InputShellState
import org.hisp.dhis.mobile.ui.designsystem.component.Orientation
import org.hisp.dhis.mobile.ui.designsystem.component.RadioButtonData
import org.hisp.dhis.mobile.ui.designsystem.component.SubTitle
import org.hisp.dhis.mobile.ui.designsystem.component.SupportingTextData
import org.hisp.dhis.mobile.ui.designsystem.component.SupportingTextState
import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing

@Composable
Expand Down Expand Up @@ -67,7 +71,12 @@ fun InputRadioButtonScreen() {
var selectedItemHorizontal by remember {
mutableStateOf<RadioButtonData?>(radioButtonDataItemsHorizontal[0])
}
var showSupportingText by remember { mutableStateOf(false) }
ColumnComponentContainer("Radio Buttons") {
Button(text = "Click to show/Hide supporting text") {
showSupportingText = !showSupportingText
}

SubTitle("Vertical")
InputRadioButton(
title = "Label",
Expand All @@ -77,6 +86,14 @@ fun InputRadioButtonScreen() {
selectedItemVertical = it
},
state = InputShellState.UNFOCUSED,
supportingText = if (showSupportingText) {
listOf(
SupportingTextData("Required", state = SupportingTextState.ERROR),
SupportingTextData(lorem + lorem + lorem, state = SupportingTextState.WARNING),
)
} else {
emptyList()
},
)
Spacer(Modifier.size(Spacing.Spacing18))
InputRadioButton(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.hisp.dhis.mobile.ui.designsystem.component

import androidx.compose.animation.animateContentSize
import androidx.compose.foundation.background
import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.foundation.layout.Arrangement
Expand Down Expand Up @@ -62,7 +63,12 @@ fun InputShell(
isRequiredField: Boolean = false,
modifier: Modifier = Modifier,
) {
Column(modifier = modifier.fillMaxWidth().clip(shape = RoundedCornerShape(Radius.XS, Radius.XS))) {
Column(
modifier = modifier
.fillMaxWidth()
.clip(shape = RoundedCornerShape(Radius.XS, Radius.XS))
.animateContentSize(),
) {
var indicatorColor by remember(state) { mutableStateOf(state.color) }
var indicatorThickness by remember { mutableStateOf(Border.Thin) }
val backgroundColor = if (state != InputShellState.DISABLED) SurfaceColor.Surface else SurfaceColor.DisabledSurface
Expand Down
Loading