-
Notifications
You must be signed in to change notification settings - Fork 0
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
Switch 컴포넌트 추가 #13
base: main
Are you sure you want to change the base?
Switch 컴포넌트 추가 #13
Conversation
// Switch의 Track의 모서리를 둥글게 만들기 위한 상수입니다. | ||
private const val SwitchTrackRoundedCorner = 999 | ||
|
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.
둥근 모서리를 999 주는 거랑 CircleShape로 그냥 둥글게 만드는 거와의 차이가 있을까요...?
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.
아이고 너무 늦게 봤네요.. figma에 나와있는 값을 그대로 사용했는데 CircleShape랑 어떻게 다른지 모르겠네요. 알아보겠습니다.
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.
조금 늦었지만 지금 다시 보니 figma에 해당 세팅이 더이상 없네요. 아무튼 모서리의 반경을 999처럼 큰 값을 하면 CircleShape와 차이가 없습니다
val switchStates = | ||
listOf(SwitchState.Unselected, SwitchState.Selected, SwitchState.Disabled) | ||
val switchSizes = listOf(SwitchSize.Large, SwitchSize.Medium, SwitchSize.Small) | ||
|
||
switchStates.forEach { state -> | ||
switchSizes.forEach { size -> | ||
samples.add( | ||
SwitchPreviewParameter( | ||
switchState = state, | ||
switchSize = size | ||
) | ||
) | ||
} | ||
} |
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.
val switchStates = | |
listOf(SwitchState.Unselected, SwitchState.Selected, SwitchState.Disabled) | |
val switchSizes = listOf(SwitchSize.Large, SwitchSize.Medium, SwitchSize.Small) | |
switchStates.forEach { state -> | |
switchSizes.forEach { size -> | |
samples.add( | |
SwitchPreviewParameter( | |
switchState = state, | |
switchSize = size | |
) | |
) | |
} | |
} | |
val switchStates = | |
listOf(SwitchState.Unselected, SwitchState.Selected, SwitchState.Disabled) | |
val switchSizes = listOf(SwitchSize.Large, SwitchSize.Medium, SwitchSize.Small) | |
val samples = switchStates.flatMap { state -> | |
switchSizes.map { size -> SwitchPreviewParameter(state, size) } | |
} |
밖에 LaunchedEffect도 없어도 될 것 같네요
fun Switch( | ||
switchState: SwitchState = SwitchState.Unselected, | ||
onToggle: (SwitchState) -> Unit, | ||
switchSize: SwitchSize = SwitchSize.Large, | ||
modifier: Modifier = Modifier | ||
) { |
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 Switch( | |
switchState: SwitchState = SwitchState.Unselected, | |
onToggle: (SwitchState) -> Unit, | |
switchSize: SwitchSize = SwitchSize.Large, | |
modifier: Modifier = Modifier | |
) { | |
fun Switch( | |
onToggle: (SwitchState) -> Unit, | |
modifier: Modifier = Modifier, | |
switchState: SwitchState = SwitchState.Unselected, | |
switchSize: SwitchSize = SwitchSize.Large, | |
) { |
순서 변경해주세요!
Surface( | ||
modifier = modifier | ||
.clip(CircleShape) | ||
.size(switchThumbSize(switchSize)), | ||
contentColor = HandyTheme.colors.switchThumb, | ||
) {} |
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.
Box
로 해도 괜찮지 않을까요?
Summary
Handy Component 중 Switch의 제작을 완료했습니다.
Describe your changes
To reviewers
4d198f5 : 시맨틱 색상 추가 커밋
0906624 : 스위치의 구현을 완료 커밋
f288d2f : 스위치에 ease 에니메이션 추가 커밋
@yourssu/android-maintainer