Skip to content
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

๐Ÿš€ 1๋‹จ๊ณ„ - ์žฅ๋ฐ”๊ตฌ๋‹ˆ(์ƒํ’ˆ ๋ชฉ๋ก) #79

Open
wants to merge 17 commits into
base: dothebestmayb
Choose a base branch
from

Conversation

DoTheBestMayB
Copy link

@DoTheBestMayB DoTheBestMayB commented Feb 13, 2025

๊ณ ๋ฏผํ•œ ๋‚ด์šฉ๊ณผ ์ด๋ ‡๊ฒŒ ๊ตฌํ˜„ํ•œ ์ด์œ 

  1. ์žฅ๋ฐ”๊ตฌ๋‹ˆ์— ๋‹ด๊ธด ์•„์ดํ…œ ๊ฐœ์ˆ˜๋ฅผ ์ƒํ’ˆ ๋ชฉ๋ก ๋ฆฌ์ŠคํŠธ์—์„œ ์–ด๋–ป๊ฒŒ state๋กœ ๊ด€๋ฆฌํ• ์ง€ ๊ณ ๋ฏผํ•˜๊ธฐ ์œ„ํ•œ ์กฐ๊ฑด์œผ๋กœ, ์žฅ๋ฐ”๊ตฌ๋‹ˆ ์•„์ด์ฝ˜์„ BadgeBox๋กœ ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค. ์žฅ๋ฐ”๊ตฌ๋‹ˆ์— ๋‹ด๊ธด ์•„์ดํ…œ์˜ ๊ฐœ์ˆ˜๋ฅผ ์ˆซ์ž๋กœ ํ‘œ์‹œํ•˜๊ณ ์ž ํ•ฉ๋‹ˆ๋‹ค.
  2. dynamic Color๋ฅผ false๋กœ ์„ค์ •ํ•˜์ง€ ์•Š์œผ๋ฉด ๋ฐฐ๊ฒฝ์ƒ‰์ด ํฐ์ƒ‰์œผ๋กœ ๋ณ€๊ฒฝ๋˜์ง€ ์•Š์•„ false๋กœ ์„ค์ •ํ–ˆ์Šต๋‹ˆ๋‹ค. dynamic color๋ฅผ ๊ณ ๋ คํ•ด ์ƒ‰์ƒ์„ ์ ์šฉํ•˜๋Š” ๊ฒƒ์ด ๊ตฌํ˜„ ์š”๊ตฌ์‚ฌํ•ญ์€ ์•„๋‹ˆ๋ฏ€๋กœ, ๋‹จ์ˆœํžˆ false๋กœ ์„ค์ •ํ•ด๋„ ์ถฉ๋ถ„ํ• ๊นŒ์š”?
  3. ๋ฉ€ํ‹ฐ ๋ชจ๋“ˆ์„ ์‚ฌ์šฉํ•˜๋Š” repository๋ฅผ ๋ณด๋ฉด designsystem ๋ชจ๋“ˆ์ด ์žˆ๋˜๋ฐ, designsystem์œผ๋กœ composable์„ ๊ตฌ๋ถ„ํ•˜๋Š” ๊ธฐ์ค€์„ ๋ฐฐ์šฐ๊ณ ์ž ํŒจํ‚ค์ง€๋ฅผ ์ถ”๊ฐ€ํ–ˆ์Šต๋‹ˆ๋‹ค.
  4. preview์—์„œ๋„ ์ด๋ฏธ์ง€๋ฅผ ๋ณด์—ฌ์ฃผ๋„๋ก ์„ค์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.
    ์ฐธ๊ณ ์ž๋ฃŒ : https://www.youtube.com/watch?v=NKtMQd9Izcw
  5. ์‹ค์ œ ์•ฑ์—์„œ๋Š” ์•„์ดํ…œ ๋ชฉ๋ก์„ ๋ถˆ๋Ÿฌ์˜ฌํ…๋ฐ, dummy ๋ฐ์ดํ„ฐ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋„๋ก ์„ค์ •ํ–ˆ์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ ViewModel์ด ์—†๊ธฐ ๋•Œ๋ฌธ์— ์ตœ์ƒ์œ„ Composable LaunchedEffect์—์„œ ์ดˆ๊ธฐ๋ฐ์ดํ„ฐ๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋„๋ก ์„ค์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.
  6. ๊ฐ๊ฐ์˜ Composable์—์„œ ๊ฐœ๋ณ„์ ์ธ Scaffold๋ฅผ ๊ฐ€์ง€๋„๋ก ํ•˜๊ธฐ ์œ„ํ•ด MainActivity๊ฐ€ ์•„๋‹Œ Composable ๋‚ด๋ถ€์— ์„ ์–ธํ–ˆ์Šต๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ๊ณตํ†ต์œผ๋กœ ๋‘˜ ๋•Œ๋ณด๋‹ค ์œ ์—ฐ์„ฑ์ด ๋” ์ข‹๋‹ค๋Š” ๋ง์— ๊ณต๊ฐ์ด ๋์Šต๋‹ˆ๋‹ค.

wisemuji and others added 17 commits February 13, 2025 09:08
Copy link

@sjjeong sjjeong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ข…์„ฑ๋‹˜ ์•ˆ๋…•ํ•˜์„ธ์š”! ์žฅ๋ฐ”๊ตฌ๋‹ˆ ๋ฏธ์…˜ ๋™์•ˆ ์ž˜ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค!
์žฅ๋ฐ”๊ตฌ๋‹ˆ ๋ฏธ์…˜ 1๋‹จ๊ณ„๋ฅผ ์ž˜ ๊ตฌํ˜„ํ•ด์ฃผ์…”์„œ ์ฝ”๋ฉ˜ํŠธ ๋“œ๋ฆด๊ฒŒ ๋งŽ์ด ์—†๋„ค์š”!
์ €์˜ ๊ถ๊ธˆ์ฆ๊ณผ ์˜๊ฒฌ์„ ๋ช‡๊ฐ€์ง€ ๋‚จ๊ฒจ๋“œ๋ฆฝ๋‹ˆ๋‹ค ใ…Žใ…Ž

.padding(top = 8.dp, start = 4.dp)
)
Text(
text = stringResource(R.string.product_price_format, priceFormat.format(product.price)),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

10000 ์ด๋ผ๋Š” int๋ฅผ 10,000์› ์ด๋ผ๊ณ  ๋ณ€๊ฒฝํ•˜๊ธฐ ์œ„ํ•ด์„œ NumberFormat ์„ ์‚ฌ์šฉํ•˜์…จ๋„ค์š”!

์ €๋Š” ์ด๋ ‡๊ฒŒ ๊ฐ„๋‹จํ•˜๊ฒŒ ๋ณ€๊ฒฝํ•˜๋Š” ๊ฑฐ๋ผ๋ฉด Int -> String -> String์œผ๋กœ ๋ณ€ํ™˜ํ•˜๊ธฐ ๋ณด๋‹ค string resource์— ์„ ์–ธํ•  ๋•Œ ํ•œ๋ฒˆ์— formatting ๋˜๋„๋ก ํ•ด๋ณผ ๊ฒƒ ๊ฐ™์•„์š”

์ œ ๋ฐฉ์‹์ด ์ •๋‹ต์€ ์•„๋‹ˆ์ง€๋งŒ ์ด๋ ‡๊ฒŒ ํ•˜๋Š” ๋ฐฉ๋ฒ•๋„ ์žˆ๋‹ค ์ •๋„๋กœ ์ดํ•ดํ•ด์ฃผ์‹œ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค
string format ๊ด€๋ จํ•ด์„œ ๊ฒ€์ƒ‰ํ•˜์‹œ๋ฉด ์ž๋ฃŒ๊ฐ€ ๋งŽ์ด ์žˆ์„๊บผ๋ผ์„œ ์ฐธ๊ณ ํ•ด๋ณด๊ณ  ๋ฐ˜์˜ํ•ด๋ณด์‹œ๋Š” ๊ฒƒ๋„ ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š”~


// viewModel์ด ์—†์œผ๋ฏ€๋กœ ์—ฌ๊ธฐ์„œ ์•„์ดํ…œ ๋ชฉ๋ก์„ ๊ฐ€์ ธ์˜จ๋‹ค.
LaunchedEffect(true) {
state = state.copy(isLoading = true)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ProductListState์˜ isLoading์ด ๊ธฐ๋ณธ๊ฐ’์ด true ์ธ๋ฐ LauncedEffect ๋‚ด๋ถ€์—์„œ true๋กœ ์ดˆ๊ธฐํ™” ํ•ด์ฃผ์‹œ๋Š” ์ด์œ ๊ฐ€ ์žˆ๋Š”์ง€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค

}

// viewModel์ด ์—†์œผ๋ฏ€๋กœ ์—ฌ๊ธฐ์„œ ์•„์ดํ…œ ๋ชฉ๋ก์„ ๊ฐ€์ ธ์˜จ๋‹ค.
LaunchedEffect(true) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ €๋Š” ๋ณดํ†ต 1ํšŒ์„ฑ์œผ๋กœ ํ•  ๋•Œ Unit์„ ์‚ฌ์šฉํ•˜๋Š” ํŽธ์ธ๋ฐ true์ธ Boolean๊ฐ’์„ ๋„ฃ์–ด์ฃผ์‹  ์ด์œ ๊ฐ€ ๊ถ๊ธˆํ•ด์š”

Comment on lines +65 to +70
if (!state.isLoading) {
ProductListScreen(
state = state,
modifier = modifier,
)
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isLoading์ด true์ผ ๋•Œ ์ผ€์ด์Šค๋„ ์žˆ์œผ๋ฉด ๋” ์ข‹์„ ๊ฒƒ ๊ฐ™์€๋ฐ ์–ด๋–ป๊ฒŒ ์ƒ๊ฐํ•˜์‹œ๋‚˜์š”?

Comment on lines +91 to +107
if (showScrollToTopButton) {
FloatingActionButton(
modifier = Modifier
.padding(bottom = 16.dp, end = 16.dp),
onClick = {
scope.launch {
lazyState.animateScrollToItem(0)
}
},
containerColor = MaterialTheme.colorScheme.primary
) {
Icon(
imageVector = Icons.Default.KeyboardArrowUp,
contentDescription = null,
)
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๋‹จ์ˆœํžˆ if๋กœ visible์ฒ˜๋ฆฌ ํ•˜๋Š” ๊ฒƒ ๋ณด๋‹ค AnimatedVisibility๋ผ๋Š” ๊ฒƒ์„ ์“ฐ๋ฉด ๋” ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ๋งŒ๋“ค์–ด ๋ณผ ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์š”!

Comment on lines +122 to +129
// footer ์—ฌ๋ฐฑ
item {
Box(
modifier = Modifier
.fillMaxWidth()
.height(100.dp)
)
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์Šคํฌ๋ฃฐ ๋งจ ๋งˆ์ง€๋ง‰์— ์—ฌ๋ฐฑ์„ ์ฃผ๊ณ  ์‹ถ์€ ๊ฑฐ๋ผ๋ฉด LazyVerticalGrid ํŒŒ๋ผ๋ฏธํ„ฐ์— contentPadding์„ ๋„ฃ์–ด์ค˜๋„ ๋  ๊ฒƒ ๊ฐ™์•„์š”! ํ˜น์‹œ ๋‹ค๋ฅธ ์˜๋„๊ฐ€ ์žˆ๋‹ค๋ฉด ๋ง์”€ํ•ด์ฃผ์„ธ์š”~

@sjjeong
Copy link

sjjeong commented Feb 14, 2025

dynamic Color๋ฅผ false๋กœ ์„ค์ •ํ•˜์ง€ ์•Š์œผ๋ฉด ๋ฐฐ๊ฒฝ์ƒ‰์ด ํฐ์ƒ‰์œผ๋กœ ๋ณ€๊ฒฝ๋˜์ง€ ์•Š์•„ false๋กœ ์„ค์ •ํ–ˆ์Šต๋‹ˆ๋‹ค. dynamic color๋ฅผ ๊ณ ๋ คํ•ด ์ƒ‰์ƒ์„ ์ ์šฉํ•˜๋Š” ๊ฒƒ์ด ๊ตฌํ˜„ ์š”๊ตฌ์‚ฌํ•ญ์€ ์•„๋‹ˆ๋ฏ€๋กœ, ๋‹จ์ˆœํžˆ false๋กœ ์„ค์ •ํ•ด๋„ ์ถฉ๋ถ„ํ• ๊นŒ์š”?
๋„ต ์ด๋ฒˆ ๋ฏธ์…˜์—์„œ dynamic color๋Š” ์ค‘์š”ํ•œ ์‚ฌํ•ญ์ด ์•„๋‹ˆ๊ธฐ ๋•Œ๋ฌธ์— ์‹ ๊ฒฝ์“ฐ์ง€ ์•Š์œผ์…”๋„ ๋ฉ๋‹ˆ๋‹ค ใ…Žใ…Ž

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants