diff --git a/presentation/src/main/java/com/kusitms/presentation/model/profile/edit/ProfileEditViewModel.kt b/presentation/src/main/java/com/kusitms/presentation/model/profile/edit/ProfileEditViewModel.kt index 704abbb..a241ca6 100644 --- a/presentation/src/main/java/com/kusitms/presentation/model/profile/edit/ProfileEditViewModel.kt +++ b/presentation/src/main/java/com/kusitms/presentation/model/profile/edit/ProfileEditViewModel.kt @@ -72,9 +72,21 @@ class ProfileEditViewModel @Inject constructor( validateFields() } + fun updateEmail(newEmail: String) { + _email.value = newEmail + validateFields() + } + + fun updatePhoneNumber(newPhoneNumber: String) { + _phoneNum.value = newPhoneNumber + validateFields() + } + private fun validateFields() { _isAllFieldsValid.value = _major.value.isNotBlank() && _selectedPart.value != null && - _interests.value.isNotEmpty() + _interests.value.isNotEmpty() && + _email.value.isNotBlank() && + _phoneNum.value.isNotBlank() } } \ No newline at end of file diff --git a/presentation/src/main/java/com/kusitms/presentation/ui/profile/edit/ProfileEditScreen.kt b/presentation/src/main/java/com/kusitms/presentation/ui/profile/edit/ProfileEditScreen.kt index 5dc32d3..889b8be 100644 --- a/presentation/src/main/java/com/kusitms/presentation/ui/profile/edit/ProfileEditScreen.kt +++ b/presentation/src/main/java/com/kusitms/presentation/ui/profile/edit/ProfileEditScreen.kt @@ -11,7 +11,9 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width +import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.verticalScroll import androidx.compose.material3.Card import androidx.compose.material3.CardDefaults import androidx.compose.material3.Icon @@ -32,6 +34,7 @@ import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.kusitms.presentation.R import com.kusitms.presentation.common.ui.KusitmsMarginVerticalSpacer +import com.kusitms.presentation.common.ui.KusitmsSnackField import com.kusitms.presentation.common.ui.KusitsmTopBarBackTextWithIcon import com.kusitms.presentation.common.ui.theme.KusitmsColorPalette import com.kusitms.presentation.common.ui.theme.KusitmsTypo @@ -52,6 +55,8 @@ fun ProfileEditScreen( viewModel: ProfileEditViewModel = hiltViewModel(), onBack: () -> Unit, ) { + val scrollState = rememberScrollState() + val expanded by viewModel.expended.collectAsStateWithLifecycle() val email by viewModel.email.collectAsState() val phoneNum by viewModel.phoneNum.collectAsState() @@ -115,6 +120,7 @@ fun ProfileEditScreen( .fillMaxWidth() .padding(20.dp) .background(KusitmsColorPalette.current.Grey900) + .verticalScroll(scrollState) .height(910.dp), verticalArrangement = Arrangement.Top, horizontalAlignment = Alignment.Start @@ -141,21 +147,34 @@ fun ProfileEditScreen( } } Spacer(modifier = Modifier.height(20.dp)) - Text(text = stringResource(id = R.string.signin_member_title1), style = KusitmsTypo.current.SubTitle2_Semibold, color = KusitmsColorPalette.current.Grey300) + Text( + text = stringResource(id = R.string.signin_member_title1), + style = KusitmsTypo.current.SubTitle2_Semibold, + color = KusitmsColorPalette.current.Grey300 + ) Spacer(modifier = Modifier.height(28.dp)) - Text(text = stringResource(id = R.string.signin_member_caption1_1), style = KusitmsTypo.current.Caption1, color = KusitmsColorPalette.current.Grey400) + Text( + text = stringResource(id = R.string.signin_member_caption1_1), + style = KusitmsTypo.current.Caption1, + color = KusitmsColorPalette.current.Grey400 + ) Spacer(modifier = Modifier.height(5.dp)) SignInFixedInput(modelValue = name) Spacer(modifier = Modifier.height(20.dp)) //전공 - Text(text = stringResource(id = R.string.signin_member_caption1_2), style = KusitmsTypo.current.Caption1, color = KusitmsColorPalette.current.Grey400) + Text( + text = stringResource(id = R.string.signin_member_caption1_2), + style = KusitmsTypo.current.Caption1, + color = KusitmsColorPalette.current.Grey400 + ) Spacer(modifier = Modifier.height(5.dp)) KusitmsInputField( text = R.string.signin_member_hint1_1, value = major, - onValueChange = viewModel::updateMajor) - if(major.length > 20) { + onValueChange = viewModel::updateMajor + ) + if (major.length > 20) { Spacer(modifier = Modifier.height(4.dp)) Text( text = "최대 20자까지 입력할 수 있어요", @@ -165,7 +184,76 @@ fun ProfileEditScreen( } Spacer(modifier = Modifier.height(24.dp)) + //파트 선택 + Text( + text = stringResource(id = R.string.signin_member_caption1_3), + style = KusitmsTypo.current.Caption1, + color = KusitmsColorPalette.current.Grey400 + ) + Spacer(modifier = Modifier.height(5.dp)) + (if (!selectedPart.isNullOrEmpty()) { + selectedPart + } else { + stringResource(R.string.signin_member_hint1_2) + })?.let { + KusitmsSnackField( + text = it, + onSnackClick = { + isOpenPartBottomSheet = true + } + ) + } + + //관심 카테고리 + Spacer(modifier = Modifier.height(24.dp)) + Text( + text = stringResource(id = R.string.signin_member_caption1_4), + style = KusitmsTypo.current.Caption1, + color = KusitmsColorPalette.current.Grey400 + ) + Spacer(modifier = Modifier.height(5.dp)) + KusitmsSnackField( + text = likeCategoryText, + onSnackClick = { + isOpenLikeCategoryBottomSheet = true + } + ) + + + Spacer(modifier = Modifier.height(40.dp)) + Text( + text = stringResource(id = R.string.signin_member_title2), + style = KusitmsTypo.current.SubTitle2_Semibold, + color = KusitmsColorPalette.current.Grey300 + ) + //이메일 + Spacer(modifier = Modifier.height(24.dp)) + Text( + text = stringResource(id = R.string.signin_member_caption1_5), + style = KusitmsTypo.current.Caption1, + color = KusitmsColorPalette.current.Grey400 + ) + Spacer(modifier = Modifier.height(5.dp)) + KusitmsInputField( + text = R.string.signin_member_hint1_4, + value = email, + onValueChange = viewModel::updateEmail + ) + + //전화번호 + Spacer(modifier = Modifier.height(20.dp)) + Text( + text = stringResource(id = R.string.signin_member_caption1_6), + style = KusitmsTypo.current.Caption1, + color = KusitmsColorPalette.current.Grey400 + ) + Spacer(modifier = Modifier.height(5.dp)) + KusitmsInputField( + text = R.string.signin_member_hint1_5, + value = phoneNum, + onValueChange = viewModel::updatePhoneNumber + ) } } }