-
Notifications
You must be signed in to change notification settings - Fork 1
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
[UI/#9] 월간 캘린더 화면 #18
Conversation
…w-ui # Conflicts: # feature/build.gradle.kts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오늘부터 외칠게요 갓석준.
코드가 너무 맛있어서 보는 내내 행복했습니다,,,,
최고!!!!!!
|
||
@Composable | ||
fun CalendarMonths( | ||
modifier: Modifier = Modifier, | ||
listState: LazyListState, | ||
onDateSelected: (LocalDate) -> Unit, | ||
pages: Int, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CalendarMonths
하고 CalendarMonth
의 네이밍이 좀 더 구분이 됐으면 좋겠는데 마땅한 네이밍이 떠오르지 않네욤,,,,흠,,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
혹시라도 나중에 좋은 아이디어 있으면 추천 부탁드려여~!!
fun getPageCount(): Int { | ||
return (END_YEAR - START_YEAR) * 12 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fun getPageCount(): Int { | |
return (END_YEAR - START_YEAR) * 12 | |
} | |
fun getPageCount(): Int = (END_YEAR - START_YEAR) * 12 |
이렇게도 할 수 있을 것 같네용
var currentDate by remember { mutableStateOf(selectedDate) } | ||
var currentPage by remember { mutableIntStateOf(listState.firstVisibleItemIndex)} | ||
|
||
var isListExpanded by remember { mutableStateOf(false) } | ||
var isWeekEnabled by remember { mutableStateOf(false) } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
줄바꿈도 너무 깔끔해요,,,,,,,
LaunchedEffect(key1 = listState) { | ||
snapshotFlow { listState.firstVisibleItemIndex } | ||
.distinctUntilChanged() | ||
.collect{ | ||
val swipeDirection = (listState.firstVisibleItemIndex - currentPage).coerceIn(-1, 1).toLong() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
distinctUntilChanged()
까지 폼미ㄷㄷ,,,,,,,,,
package com.terning.feature.calendar | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Row |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CalendarTopBar
랑 WeekDaysHeader
는 component 패키지로 따로 빼도 괜찮을 것 같아요..!
캘린더 화면을 그리는 CalendarRoute
, CalendarMonth
, CalendarDay
는 이대로 남겨도 괜찮을 것 같네용
|
||
@Immutable | ||
data class Scrap( | ||
val text: String, | ||
val backgroundColor: Color | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Immutable
을 넣어준 이유는 불변함을 강조하기 위함인가용??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵!! 사실 이게 레퍼런스에서 본 Month와 Day 데이터에서 착안한 아이디어인데, 스크랩 자체가 서버에서 받아오면 클라이언트 측에선 바꿀 일이 없을 것 같아서 조금이나마 성능에 도움이 될까봐 이렇게 구현해봤어요!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
복잡한 캘린더 합숙 전에 뚝딱 해내신거 존경,,,,,, 넘 잘하신다.
onMonthNavigationButtonClicked = { direction -> | ||
coroutineScope.launch { | ||
listState.animateScrollToItem( | ||
index = listState.firstVisibleItemIndex + direction, | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
animateScrollToItem으로 매끄럽게 전환할 수 있근여 🥹..!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LazyListState에서 사용하는 전환 방법이라고 하네요 :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오호!! 이건 처음보는건데!! 좋네요😊
CalendarMonths( | ||
modifier = Modifier.fillMaxSize(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CalendarMonths안에서 Column에 fillMaxSize이 적용되고 있는 것 같은데 여기서도 fillMaxSize를 넘겨주는 이유가 뭔가용?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
클래스 이름이랑 제 코딩 방식 때문에 혼동이 생긴 것 같네요,,,
CalendarMonths 내부에선 LazyRow가 해당 Modifier를 인자로 받아 사용하도록 구현돼있는데, 여기서 인자로 넘기지 않고 그냥 LazyRow 내부에서 사용해야 혼동이 없겠네요...
style = TerningTheme.typography.body7, | ||
color = if(day == R.string.calendar_text_sunday) SundayRed else Black, | ||
fontSize = 13.sp, | ||
textAlign = TextAlign.Center |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style에서 body7 스타일을 적용해두었는데 따로 fontSize를 지정하신 이유가 있나요?! 피그마상에서도 12 사이즈인 것 같아요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
역시 예리하시네요!! 팀원들을 위한 이스터에그~ 가 아니라 제 부주의입니다ㅎㅎ 바로 수정할게요!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
갓석준 진짜 캘린더를 이렇게 빨리 구현한다구?!??? 진짜 최고다 짱이다!!!!!
scrapList: List<Scrap> | ||
) { | ||
LazyColumn( | ||
modifier = modifier.fillMaxWidth().padding(top = 3.dp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요거 줄바꿈 하면 더 보기 좋을 것 같아요!
onMonthNavigationButtonClicked = { direction -> | ||
coroutineScope.launch { | ||
listState.animateScrollToItem( | ||
index = listState.firstVisibleItemIndex + direction, | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오호!! 이건 처음보는건데!! 좋네요😊
⛳️ Work Description
📸 Screenshot
terning_calendar01.mp4
📢 To Reviewers