diff --git a/app/src/main/java/com/xquare/xquare_android/feature/schedule/WriteScheduleScreen.kt b/app/src/main/java/com/xquare/xquare_android/feature/schedule/WriteScheduleScreen.kt index 3a95caf4..3c60a2ff 100644 --- a/app/src/main/java/com/xquare/xquare_android/feature/schedule/WriteScheduleScreen.kt +++ b/app/src/main/java/com/xquare/xquare_android/feature/schedule/WriteScheduleScreen.kt @@ -90,47 +90,50 @@ fun WriteScheduleContent( ) { var name by remember { mutableStateOf(schedulesData?.name ?: "") } var date by remember { mutableStateOf(schedulesData?.date?:"") } + val title by remember { mutableStateOf(if (schedulesData == null) "일정 작성" else "일정 수정") } + val btnText by remember { mutableStateOf(if (schedulesData == null) "등록" else "수정") } var timerModalState by remember { mutableStateOf(false) } val btnEnabled = name.length > 1 && date.isNotEmpty() - Header( - painter = painterResource(id = R.drawable.ic_back), - title = "일정 작성", - btnText = "등록", - btnEnabled = btnEnabled, - onIconClick = onIconClick, - onBtnClick = { onBtnClick(name, date) } - ) - Column( - modifier = Modifier - .padding(horizontal = 16.dp) - .fillMaxSize() - .padding(top = DevicePaddings.statusBarHeightDp.dp) - ) { - Spacer(modifier = Modifier.height(32.dp)) - HighlightedText(text = "일정제목") - Spacer(modifier = Modifier.height(8.dp)) - TextField( - text = name, - onTextChange = { name = it }, - placeholder = "최소 2자 이상" + Column(modifier = Modifier.padding(top = DevicePaddings.statusBarHeightDp.dp)) { + Header( + painter = painterResource(id = R.drawable.ic_back), + title = title, + btnText = btnText, + btnEnabled = btnEnabled, + onIconClick = onIconClick, + onBtnClick = { onBtnClick(name, date) } ) - Spacer(modifier = Modifier.height(20.dp)) - HighlightedText(text = "날짜 선택") - Spacer(modifier = Modifier.height(8.dp)) - TextFieldBtn(text = date, placeholder = "날짜를 선택해주세요") { - timerModalState = true - } - if (timerModalState) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - DatePickerModal( - defaultDate = date, - onCancel = { timerModalState = false }, - onConfirm = { - date = it - timerModalState = false - } - ) + Column( + modifier = Modifier + .fillMaxSize() + .padding(horizontal = 16.dp) + ) { + Spacer(modifier = Modifier.height(32.dp)) + HighlightedText(text = "일정제목") + Spacer(modifier = Modifier.height(8.dp)) + TextField( + text = name, + onTextChange = { name = it }, + placeholder = "최소 2자 이상" + ) + Spacer(modifier = Modifier.height(20.dp)) + HighlightedText(text = "날짜 선택") + Spacer(modifier = Modifier.height(8.dp)) + TextFieldBtn(text = date, placeholder = "날짜를 선택해주세요") { + timerModalState = true + } + if (timerModalState) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + DatePickerModal( + defaultDate = date, + onCancel = { timerModalState = false }, + onConfirm = { + date = it + timerModalState = false + } + ) + } } } }