From a562c3dffa321267f3b5c97d4a152f5944eefc61 Mon Sep 17 00:00:00 2001 From: Jung SeokJoon Date: Sun, 4 Aug 2024 09:07:04 +0900 Subject: [PATCH 1/3] =?UTF-8?q?fix=20MissionMateTextFieldGroup=20-=20?= =?UTF-8?q?=ED=82=A4=EB=B3=B4=EB=93=9C=20=EC=98=AC=EB=9D=BC=EC=98=AC=20?= =?UTF-8?q?=EB=95=8C=20guideText=20=EA=B0=80=EB=A0=A4=EC=A7=80=EB=8A=94=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/designsystem/component/TextField.kt | 87 ++++++++++++------- 1 file changed, 55 insertions(+), 32 deletions(-) diff --git a/core/designsystem/src/main/java/com/goalpanzi/mission_mate/core/designsystem/component/TextField.kt b/core/designsystem/src/main/java/com/goalpanzi/mission_mate/core/designsystem/component/TextField.kt index 24df52cb..06dd8d4c 100644 --- a/core/designsystem/src/main/java/com/goalpanzi/mission_mate/core/designsystem/component/TextField.kt +++ b/core/designsystem/src/main/java/com/goalpanzi/mission_mate/core/designsystem/component/TextField.kt @@ -13,6 +13,8 @@ import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.text.BasicTextField +import androidx.compose.foundation.text.KeyboardActions +import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -45,26 +47,32 @@ fun MissionMateTextField( onValueChange: (String) -> Unit, modifier: Modifier = Modifier, @StringRes hintId : Int? = null, + @StringRes guidanceId : Int? = null, isError : Boolean = false, + useMaxLength : Boolean = false, textStyle: TextStyle = MissionMateTypography.body_lg_regular, hintStyle: TextStyle = MissionMateTypography.body_lg_regular, textColor: Color = ColorGray1_FF404249, hintColor: Color = ColorGray3_FF727484, + guidanceColor : Color = Color(0xFF4F505C), + errorColor : Color = Color(0xFFFF6464), containerColor: Color = ColorWhite_FFFFFFFF, unfocusedHintColor: Color = ColorGray5_80F5F6F9, borderStroke: BorderStroke = BorderStroke(1.dp, ColorGray4_FFE5E5E5), focusedBorderStroke: BorderStroke = BorderStroke(1.dp, ColorGray4_FFE5E5E5), errorBorderStroke: BorderStroke = BorderStroke(2.dp, ColorRed_FFFF5858), shape: Shape = RoundedCornerShape(12.dp), + maxLength : Int = Int.MAX_VALUE, isSingleLine: Boolean = true, visualTransformation: VisualTransformation = VisualTransformation.None, + keyboardOptions: KeyboardOptions = KeyboardOptions.Default, + keyboardActions: KeyboardActions = KeyboardActions.Default, textAlign : Alignment = Alignment.CenterStart, contentPadding : PaddingValues = PaddingValues(horizontal = 16.dp) ) { var isFocused by remember { mutableStateOf(false) } BasicTextField( modifier = modifier - .heightIn(min = 60.dp) .onFocusChanged { isFocused = it.isFocused }, @@ -74,34 +82,48 @@ fun MissionMateTextField( color = textColor ), visualTransformation = visualTransformation, + keyboardActions = keyboardActions, + keyboardOptions = keyboardOptions, onValueChange = onValueChange, decorationBox = { innerTextField -> - Box( - modifier = Modifier - .clip(shape) - .border( - border = if (isError) errorBorderStroke - else if (isFocused) focusedBorderStroke - else borderStroke, - shape = shape - ) - .background( - if (!isFocused && text.isEmpty()) unfocusedHintColor - else containerColor - ) - .padding(contentPadding), - contentAlignment = textAlign + Column( + verticalArrangement = Arrangement.spacedBy(8.dp) ) { - if(text.isBlank()){ + Box( + modifier = Modifier + .fillMaxWidth() + .heightIn(min = 60.dp) + .clip(shape) + .border( + border = if (isError) errorBorderStroke + else if (isFocused) focusedBorderStroke + else borderStroke, + shape = shape + ) + .background( + if (!isFocused && text.isEmpty()) unfocusedHintColor + else containerColor + ) + .padding(contentPadding), + contentAlignment = textAlign + ) { + if(text.isBlank()){ + Text( + text = hintId?.let { stringResource(id = it) } ?: "", + style = hintStyle, + color = hintColor + ) + } + innerTextField() + } + if(guidanceId != null){ Text( - text = hintId?.let { stringResource(id = it) } ?: "", - style = hintStyle, - color = hintColor + text = stringResource(id = guidanceId) + if(useMaxLength) "(${text.length}/$maxLength)" else "", + style = MissionMateTypography.body_md_regular, + color = if(isError) errorColor else guidanceColor ) } - innerTextField() } - } ) } @@ -119,7 +141,9 @@ fun MissionMateTextFieldGroup( isError : Boolean = false, titleColor : Color = Color(0xFF4F505C), guidanceColor : Color = Color(0xFF4F505C), - errorColor : Color = Color(0xFFFF6464) + errorColor : Color = Color(0xFFFF6464), + keyboardOptions: KeyboardOptions = KeyboardOptions.Default, + keyboardActions: KeyboardActions = KeyboardActions.Default, ){ Column( modifier = modifier, @@ -127,7 +151,6 @@ fun MissionMateTextFieldGroup( ) { if(titleId != null){ Text( - modifier = Modifier.padding(bottom = 4.dp), text = stringResource(id = titleId), style = MissionMateTypography.body_md_bold, color = titleColor @@ -138,15 +161,15 @@ fun MissionMateTextFieldGroup( onValueChange = onValueChange, modifier = Modifier.fillMaxWidth(), hintId = hintId, - isError = isError + isError = isError, + useMaxLength = useMaxLength, + guidanceId = guidanceId, + maxLength = maxLength, + guidanceColor = guidanceColor, + errorColor = errorColor, + keyboardOptions = keyboardOptions, + keyboardActions = keyboardActions ) - if(guidanceId != null){ - Text( - text = stringResource(id = guidanceId) + if(useMaxLength) "(${text.length}/$maxLength)" else "", - style = MissionMateTypography.body_md_regular, - color = if(isError) errorColor else guidanceColor - ) - } } } From a70d5409b9852951a027df5d4e7254f2189a9080 Mon Sep 17 00:00:00 2001 From: Jung SeokJoon Date: Sun, 4 Aug 2024 09:09:08 +0900 Subject: [PATCH 2/3] =?UTF-8?q?fix=20OnboardingScreen,=20BoardSetupScreen?= =?UTF-8?q?=20-=20navigationBarsPadding=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mission_mate/feature/onboarding/screen/OnboardingScreen.kt | 3 ++- .../feature/onboarding/screen/boardsetup/BoardSetupScreen.kt | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/feature/onboarding/src/main/java/com/goalpanzi/mission_mate/feature/onboarding/screen/OnboardingScreen.kt b/feature/onboarding/src/main/java/com/goalpanzi/mission_mate/feature/onboarding/screen/OnboardingScreen.kt index 7e2a2b85..c9b0b561 100644 --- a/feature/onboarding/src/main/java/com/goalpanzi/mission_mate/feature/onboarding/screen/OnboardingScreen.kt +++ b/feature/onboarding/src/main/java/com/goalpanzi/mission_mate/feature/onboarding/screen/OnboardingScreen.kt @@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.navigationBarsPadding import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.statusBarsPadding import androidx.compose.foundation.layout.wrapContentHeight @@ -65,7 +66,7 @@ fun OnboardingScreen( contentScale = ContentScale.FillWidth ) Column( - modifier = modifier.statusBarsPadding(), + modifier = modifier.statusBarsPadding().navigationBarsPadding(), horizontalAlignment = Alignment.CenterHorizontally ) { IconButton( diff --git a/feature/onboarding/src/main/java/com/goalpanzi/mission_mate/feature/onboarding/screen/boardsetup/BoardSetupScreen.kt b/feature/onboarding/src/main/java/com/goalpanzi/mission_mate/feature/onboarding/screen/boardsetup/BoardSetupScreen.kt index 0b9ddc4e..b5cd31de 100644 --- a/feature/onboarding/src/main/java/com/goalpanzi/mission_mate/feature/onboarding/screen/boardsetup/BoardSetupScreen.kt +++ b/feature/onboarding/src/main/java/com/goalpanzi/mission_mate/feature/onboarding/screen/boardsetup/BoardSetupScreen.kt @@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.ColumnScope import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.imePadding +import androidx.compose.foundation.layout.navigationBarsPadding import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.statusBarsPadding import androidx.compose.foundation.layout.wrapContentHeight @@ -145,7 +146,6 @@ fun BoardSetupRoute( ) } -@OptIn(ExperimentalMaterial3Api::class) @Composable fun BoardSetupScreen( currentStep: BoardSetupStep, @@ -172,6 +172,7 @@ fun BoardSetupScreen( .fillMaxSize() .background(ColorWhite_FFFFFFFF) .statusBarsPadding() + .navigationBarsPadding() .imePadding() ) { BoardSetupNavigationBar( From 5141368a1c72c6bfaed7df0a97e080be2bfef91f Mon Sep 17 00:00:00 2001 From: Jung SeokJoon Date: Sun, 4 Aug 2024 09:10:07 +0900 Subject: [PATCH 3/3] =?UTF-8?q?fix=20BoardSetupMission=20-=20=EC=8A=A4?= =?UTF-8?q?=ED=81=AC=EB=A1=A4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../onboarding/screen/boardsetup/BoardSetupMission.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/feature/onboarding/src/main/java/com/goalpanzi/mission_mate/feature/onboarding/screen/boardsetup/BoardSetupMission.kt b/feature/onboarding/src/main/java/com/goalpanzi/mission_mate/feature/onboarding/screen/boardsetup/BoardSetupMission.kt index 10642630..e8770a80 100644 --- a/feature/onboarding/src/main/java/com/goalpanzi/mission_mate/feature/onboarding/screen/boardsetup/BoardSetupMission.kt +++ b/feature/onboarding/src/main/java/com/goalpanzi/mission_mate/feature/onboarding/screen/boardsetup/BoardSetupMission.kt @@ -4,6 +4,8 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource @@ -13,13 +15,15 @@ import com.goalpanzi.mission_mate.feature.onboarding.R @Composable fun BoardSetupMission( - missionTitle : String, - onTitleChange : (String) -> Unit, + missionTitle: String, + onTitleChange: (String) -> Unit, modifier: Modifier = Modifier -){ +) { + val scrollState = rememberScrollState() Column( modifier = modifier .fillMaxSize() + .verticalScroll(scrollState) .padding(horizontal = 24.dp) ) { BoardSetupDescription(