-
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
Scaffold 구현 #15
base: main
Are you sure you want to change the base?
Scaffold 구현 #15
Conversation
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.
수고하셨습니다~ 추가로 PR 설명에 적어주신 내용이 주석에도 포함되면 좋을 것 같아요! (그려지는 순서에 대한 설명)
fab: @Composable () -> Unit, | ||
bottomBar: @Composable () -> Unit | ||
) { | ||
val snackBarPxValue = LocalDensity.current.run { SnackBarBottomSpacing.toPx() }.toInt() |
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.
with(LocalDensity.current) { ... }
보통 이렇게 하는 게 일반적인데 취향차이인 것 같긴 해요
|
||
val looseConstraints = constraints.copy(minWidth = 0, minHeight = 0) | ||
|
||
val topBarPlaceable = subcompose(ScaffoldLayoutContent.TopBar) { |
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.
subcompose 괄호 안에 넣어주는 게 무엇을 의미하는건가요?
traversalIndex = 2f | ||
} | ||
) { | ||
content(PaddingValues(0.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.
content padding 값은 항상 0인건가요?
val snackBarPlaceable = subcompose(ScaffoldLayoutContent.Snackbar) { | ||
Box(modifier = Modifier | ||
.padding(horizontal = SnackBarHorizontalSpacing) // TODO : SnackBar 컴포넌트 자체에서 margin을 줄지 여기서 주어야 할지? | ||
.semantics { |
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.
흠.. 머테리얼 SnackBar를 사용해보았을땐 기본으로 화면 너비를 채우고 밖에서 마진을 넣어주게 되어있긴 하네요
지금은 제가 SnackBar 컴포넌트 자체에 마진을 주긴했는데 이 파일에서 넣어주는 걸로 할까요?
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.
아하 그러면 snackbar에 이미 되어있다면 여기서 마진 없도록 하겠습니다~!
val bottomBarVerticalOffset = layoutHeight - bottomBarPlaceable.height | ||
val fabVerticalOffset = | ||
bottomBarVerticalOffset - fabPlaceable.height - fabBottomMarginPxValue | ||
val snackBarVerticalOffset = fabVerticalOffset - snackBarPlaceable.height - snackBarPxValue |
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.
fab이 없을 땐 fabVerticalOffset이 bottomBarVerticalOffset과 같아야 할 것 같아요.
쉽게 설명하자면 지금 상황에서 fab이 없을 때 snackBar가 어디에 배치될지 생각해보심 됩니다. 아마 생각보다 높은 곳에 배치될거예요. (fab 마진 + snackBar 마진 만큼)
작업 내용
Scaffold 구현
Preview 사진
아직 component들이 구현 중이라 색상으로 대체했습니다.
구성요소
옵션 설명
그려지는 순서
semantic의 traversalIndex값이 작은 순서대로
topBar -> bottomBar -> content -> FAB -> snackBar
*padding값
화면에서의 padding values -> object로 관리
snackBar : horizontal 16.dp, bottom 16.dp
FAB : end 16.dp, bottom 32.dp
(SnackBar가 FAB보다 상단에 있어야 함)