From 70861b9d7cceda0dc5c15cb697bc9d07e14bf653 Mon Sep 17 00:00:00 2001 From: skyblue1232 <97932282+skyblue1232@users.noreply.github.com> Date: Sat, 24 Aug 2024 00:50:58 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B3=B5=EA=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/add/addgroup/MembersSpace.kt | 225 +++++++++--------- 1 file changed, 106 insertions(+), 119 deletions(-) diff --git a/app/src/main/java/com/hgh/na_o_man/presentation/ui/add/addgroup/MembersSpace.kt b/app/src/main/java/com/hgh/na_o_man/presentation/ui/add/addgroup/MembersSpace.kt index 7844b10..2d71e4e 100644 --- a/app/src/main/java/com/hgh/na_o_man/presentation/ui/add/addgroup/MembersSpace.kt +++ b/app/src/main/java/com/hgh/na_o_man/presentation/ui/add/addgroup/MembersSpace.kt @@ -8,8 +8,10 @@ import androidx.compose.foundation.border import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.RoundedCornerShape @@ -74,141 +76,126 @@ fun MembersSpace( EndTopCloud() } - Box( - modifier = Modifier.fillMaxSize().padding(10.dp), - contentAlignment = Alignment.Center + Column( + modifier = Modifier + .fillMaxSize() + .padding(10.dp), + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.Center ) { - Box( + // 중앙 이미지 + Image( + imageVector = ImageVector.vectorResource(id = R.drawable.ic_nangman_23), + contentDescription = "Center Image", modifier = Modifier - .align(Alignment.Center) - .padding(bottom = 230.dp), - contentAlignment = Alignment.Center - ) { - Image( - imageVector = ImageVector.vectorResource(id = R.drawable.ic_nangman_23), - contentDescription = "Center Image" - ) - } + .padding(bottom = 30.dp) + ) - Box( + // 중앙 텍스트 + Text( + text = "어디에서 찍은 사진인가요?", modifier = Modifier - .align(Alignment.Center) - .padding(bottom = 160.dp), - contentAlignment = Alignment.Center - ) { - Text( - text = "어디에서 찍은 사진인가요?", - modifier = Modifier - .drawBehind { - val strokeWidth = 1.dp.toPx() - val y = size.height - strokeWidth / 2 + 10.dp.toPx() - drawLine( - color = LightWhite, - start = Offset(0f, y), - end = Offset(size.width, y), - strokeWidth = strokeWidth - ) - }, - color = LightWhite, - fontWeight = FontWeight.SemiBold - ) - } + .padding(bottom = 10.dp) + .drawBehind { + val strokeWidth = 1.dp.toPx() + val y = size.height - strokeWidth / 2 + 10.dp.toPx() + drawLine( + color = LightWhite, + start = Offset(0f, y), + end = Offset(size.width, y), + strokeWidth = strokeWidth + ) + }, + color = LightWhite, + fontWeight = FontWeight.SemiBold + ) + + Spacer(modifier = Modifier.height(20.dp)) - Column( + // 텍스트 입력 필드 + Box( modifier = Modifier - .fillMaxSize() - .padding(16.dp), - horizontalAlignment = Alignment.CenterHorizontally, - verticalArrangement = Arrangement.Center + .size(295.dp, 55.dp) + .background( + color = LightWhite.copy(alpha = 0.7f), + shape = RoundedCornerShape(20.dp) + ) + .border( + width = 1.dp, + color = LightWhite, + shape = RoundedCornerShape(20.dp) + ) ) { - // 텍스트창 - Box( + BasicTextField( + value = textValue, + onValueChange = { newValue -> + textValue = newValue + viewModel.updatePlace(newValue) + }, modifier = Modifier - .padding(top = 285.dp) - .size(295.dp, 55.dp) - .background( - color = LightWhite.copy(alpha = 0.7f), - shape = RoundedCornerShape(20.dp) - ) - .border( - width = 1.dp, - color = LightWhite, - shape = RoundedCornerShape(20.dp) - ) - ) { - BasicTextField( - value = textValue, - onValueChange = { newValue -> - textValue = newValue - viewModel.updatePlace(newValue) + .fillMaxWidth() + .align(Alignment.Center) + .onFocusChanged { state -> + isFocused = state.isFocused }, - modifier = Modifier - .fillMaxWidth() - .align(Alignment.Center) - .onFocusChanged { state -> - isFocused = state.isFocused - }, - textStyle = TextStyle( - color = SteelBlue, - background = Color.Transparent, - fontWeight = FontWeight.SemiBold, - fontSize = 14.sp, - textAlign = TextAlign.Center - ), - cursorBrush = SolidColor(SteelBlue), - decorationBox = { innerTextField -> - Box( - modifier = Modifier - .fillMaxWidth() - .align(Alignment.Center), - contentAlignment = Alignment.Center - ) { - if (textValue.isEmpty() && !isFocused) { - Text( - text = "공간을 입력해주세요.", - color = SteelBlue, - textAlign = TextAlign.Center, - fontWeight = FontWeight.SemiBold - ) - } - innerTextField() + textStyle = TextStyle( + color = SteelBlue, + background = Color.Transparent, + fontWeight = FontWeight.SemiBold, + fontSize = 14.sp, + textAlign = TextAlign.Center + ), + cursorBrush = SolidColor(SteelBlue), + decorationBox = { innerTextField -> + Box( + modifier = Modifier + .fillMaxWidth(), + contentAlignment = Alignment.Center + ) { + if (textValue.isEmpty() && !isFocused) { + Text( + text = "공간을 입력해주세요.", + color = SteelBlue, + textAlign = TextAlign.Center, + fontWeight = FontWeight.SemiBold + ) } + innerTextField() } - ) - } + } + ) + } - Box( - modifier = Modifier - .padding(bottom = 245.dp) - .fillMaxSize(), - contentAlignment = Alignment.CenterEnd - ) { - NextAppBar1( - onNextClick = { - if (textValue.isNotEmpty()) { - viewModel.handleEvents(AddContract.AddEvent.CreateGroup) - navController.navigate(AddScreenRoute.LOADING.route) - } else { - AddContract.AddSideEffect.ShowToast("텍스트를 입력해주세요.") - } - } - ) - } + Spacer(modifier = Modifier.height(10.dp)) - val context = LocalContext.current + // 네비게이션 버튼 + NextAppBar1( + onNextClick = { + if (textValue.isNotEmpty()) { + viewModel.handleEvents(AddContract.AddEvent.CreateGroup) + navController.navigate(AddScreenRoute.LOADING.route) + } else { + AddContract.AddSideEffect.ShowToast("텍스트를 입력해주세요.") + } + }, + modifier = Modifier + .padding(bottom = 55.dp) + .align(Alignment.End) + ) - LaunchedEffect(Unit) { - viewModel.effect.collect { effect -> - when (effect) { - is AddContract.AddSideEffect.NavigateToNextScreen -> { - navController.navigate(AddScreenRoute.LOADING.route) - } + // LaunchedEffect for handling side effects + val context = LocalContext.current - is AddContract.AddSideEffect.ShowToast -> { - Toast.makeText(context, effect.message, Toast.LENGTH_SHORT).show() - } - else -> {} + LaunchedEffect(Unit) { + viewModel.effect.collect { effect -> + when (effect) { + is AddContract.AddSideEffect.NavigateToNextScreen -> { + navController.navigate(AddScreenRoute.LOADING.route) + } + is AddContract.AddSideEffect.ShowToast -> { + Toast.makeText(context, effect.message, Toast.LENGTH_SHORT).show() } + else -> {} } } }