#1 ๊ฐ์
#1-1 ์ผ์
Nutri Capture ๋ฐฉํฅ์ฑ - ๊ฐ๋ฐ ์ผ์ ํ (1์ฐจ)
#1 ํ ๊ฐ๋ฐ ํํ์ ๋ํ ๋ฌธ์ ์ #1-1 ๊ณผ์ ์ ์๋ฒฝ์ฃผ์๋ ํ๋ด๊ธฐ ํ๋ก๊ทธ๋๋จธ์ ๋ถ๊ณผํ๋ค. ๋ด๊ฐ ๋ง๋ค ์ฑ ๋ํ ๊ทธ์ ๊ทธ๋ฐ ์ฑ์ผ ๊ฒ์ด๋ค. ์ ์ด๋ ์ฒ์ (์ถ์ํ ์๋๋ก ๋ง๋๋) ์ฑ์ ๋น์ฐํ ๊ทธ๋ด ๊ฒ์ด๋ค,
kenel.tistory.com
์ด์ ๊ฒ์๊ธ์์ 'ChatBar๋ฅผ ํตํด ์ ์กํ MealItem์ name ์์ฑ์ LazyColumn์์ ํ์ธ'ํ ์ ์์๋ค. ์ด์ ๋ค์ ์์
์ ๊ณํํ ์, 'nutritionInfo ๊ฐ ํ๋กํผํฐ์ 1๋1๋ก ๋์๋๋ ์์ด์ฝ์ ๊ฐ์ ธ์ค๊ฑฐ๋ ์ ์ํจ'์ด๋ค.
#1-2 ์์ด์ฝ
์์ด์ฝ์ ์ด๋์์ ์ผ๊ด์ ์ผ๋ก ๋ค์ด๋ก๋ํ๋ ๊ฑธ ์๊ฐํ์ง๋ง, ์์ด์ฝ ๊ฐ ํต์ผ์ฑ์ด ๋จ์ด์ง๋ค๋ ๋ฌธ์ ์ ์ด ์๋ค. ๊ทธ๋์ ์ง์ ๊ทธ๋ฆฌ๊ธฐ๋ก ํ๋ค. ๋ฌผ๋ก , ๋๋ฌด ๋ง์ ์๊ฐ์ ํฌ์ํ์ง ์์ ๊ฒ์ด๋ค. ์ด๊ฒ ์ด๋ค ์์ด์ฝ์ธ์ง ์์๋ณผ ์๋ง ์๋ ์์ค์ ํ๋ฆฌํฐ๋ฉด ๋๋ค.
#1-3 Inkscape
Overview | Inkscape
Overview For Designers of all Kinds The design process may begin by doodles on a napkin, a sketched mindmap, a photo of a memorable object, or a mockup in software which really wouldn't work to complete the project. Inkscape can take you from this stage to
inkscape.org
๋ฌด๋ฃ ํ๋ก๊ทธ๋จ์ธ Inkscape๋ฅผ ํตํด SVG ์์ด์ฝ์ ์ ์ํ๋ค.
#2 ์ ์๋ ์์ด์ฝ

๊ธ ์ฝ๋ ์์๋๋ก data class์ธ NutritionInfo์ ํ๋กํผํฐ 'overeatingExcess', 'fiberQuality', 'sodiumExcess', 'proteinQuality', 'flourExcess', 'refinedGrainExcess', 'refinedSugarExcess' ๋ค.
์์ด์ฝ์ ์ ์ํ๋ฉด์ ๋ ์๊ฐ์, ๊ดํ ํ์ฌ์ '๋์์ด๋'๋ผ๋ ์ง์ฑ ์ด ์๋ ๊ฒ ์๋๋ผ๋ ๊ฒ์ด๋ค. '๋์์ธ ์์'(Asset) ์ ์์ ํ๋ก๊ทธ๋๋จธ๊ฐ 'ํ๋ก๊ทธ๋๋ฐํ๋ ๊ฒธ์ฌ๊ฒธ์ฌ ํ ์ ์๋ ์ผ'์ด ์ ๋ ์๋๋ค.
๋ด๊ฐ ๋ง๋ค๊ธด ํ์ง๋ง ์ ์์ด์ฝ๋ค์ด ์ ๋ง ๋ง์์ ๋ค์ง ์๋๋ค. ์ด๋ฐ ํ๋ฆฌํฐ์ ์์ด์ฝ์ ํ๋ก์ ํธ์ ๋ฃ์ด Commitํ๋๋ ์ฐจ๋ผ๋ฆฌ ์ฃฝ๊ณ ์ถ์ ์ ๋๋ค. ๊ทธ ์ ๋๋ก ์ ํญ๊ฐ์ด ๊ฑฐ์ ๋ค. ํ์ง๋ง, ์ด ๊ฒฐ๊ณผ์ ์๋ฒฝ์ฃผ์๊ฐ ๋ ์ฃฝ์ฌ์ค์ง ์์๋. ๋์ค์ ๋ค์ ๊น๋ํ ์์ด์ฝ์ผ๋ก ๊ต์ฒดํ ๋ ์ด ์ฌ ๊ฒ์ด๋ค.
#3 ์๋ ํ์ธ
#3-1 svg ํ์ผ ์ฒจ๋ถ

์์ฑ๋ #2์ ์์ด์ฝ svg ํ์ผ๋ค์ ์๋๋ก์ด๋ ํ๋ก์ ํธ์ ๋ฃ๋๋ค. [drawable ํด๋ ์ฐํด๋ฆญ] - [New] - [Vector Asset]์์ svg ํ์ผ์ ๋ฃ์ผ๋ฉด, ์์ ๊ฐ์ด xml ํ์ผ ํ์ฅ์๋ก ํ๋ก์ ํธ์ ์ถ๊ฐ๋๋ค.
#3-2 MainActivity.kt
...
class MainActivity : ComponentActivity() {
...
override fun onCreate(savedInstanceState: Bundle?) {
...
setContent {
NutricapturenewTheme {
...
Scaffold(
...
topBar = {
TopAppBar(
title = {
...
},
actions = {
IconButton(
onClick = {
navController.navigate("statisticsScreen") {
popUpTo(navController.graph.findStartDestination().id) {
saveState = true
}
launchSingleTop = true
restoreState = true
}
},
) {
Icon(
painterResource(id = R.drawable.stacked_line_chart),
contentDescription = "ํต๊ณ"
)
}
}
)
},
...
}
) { ...
...
}
}
}
...
}
...
#3-1์์ ์ถ๊ฐํ ์์ด์ฝ์ StatisticsScreen์ ์์๋ก ๋ ๊ฒ์ด๋ค. ์ด๋ฅผ ์ํด, Top bar์ StatisticsScreen์ผ๋ก ์ด๋ํ๋ ๋ค์ด๊ฒ์ด์ ๋ฒํผ์ ์ถ๊ฐํ๋ค.
#3-3 StatisticsScreen.kt
...
@Composable
fun StatisticsScreen(
scope: CoroutineScope,
snackbarHostState: SnackbarHostState
) {
val nutrientIcons = arrayOf(
painterResource(id = R.drawable.pan_tool_alt),
painterResource(id = R.drawable.flour_excess),
painterResource(id = R.drawable.fiber_quality),
painterResource(id = R.drawable.sodium_excess),
painterResource(id = R.drawable.protein_quality),
painterResource(id = R.drawable.overeating_excess),
painterResource(id = R.drawable.refined_grain_excess),
painterResource(id = R.drawable.refined_sugar_excess)
)
LazyVerticalGrid(
columns = GridCells.Adaptive(minSize = Dimens.IconButton.targetSize),
modifier = Modifier
.fillMaxSize()
.padding(16.dp),
horizontalArrangement = Arrangement.spacedBy(16.dp),
verticalArrangement = Arrangement.spacedBy(16.dp)
) {
items(nutrientIcons) { nutrientIcon ->
Box(
modifier = Modifier.fillMaxSize()
) {
FilledTonalIconButton(
onClick = {
},
modifier = Modifier
.size(Dimens.IconButton.targetSize)
.padding((Dimens.IconButton.targetSize - Dimens.IconButton.stateLayer) / 2) // ์ด padding() ์ ๊ฑฐ ์, stateLayer๋ ์ฌ๋ผ์ง๊ฒ ๋จ (= stateLayer๊ฐ targetSize์ ๋๊ฐ์ ํฌ๊ธฐ๊ฐ ๋จ)
.align(Alignment.Center)
//.background(Color.Red),
) {
Icon(
painter = nutrientIcon,
contentDescription = "test",
modifier = Modifier.size(Dimens.IconButton.iconSize)
)
}
}
}
}
}
LazyColumn๊ณผ ๋์ผํ ์๋ ์๋ฆฌ๋ฅผ ๊ฐ์ง๋ LazyVerticalGrid๋ฅผ ๋๋ค.
#3-4 ์คํฌ๋ฆฐ์ท

๋งจ ์ข์ธก ์๋จ์ ์๋ ์์ด์ฝ์ ๊ตฌ๊ธ์์ ์ ๊ณตํ๋ ์์ด์ฝ์ผ๋ก, ๋น๊ต๋ฅผ ์ํด ๋ฃ์๋ค. ์ ์ ๋ ํ๋ฆฌํฐ๊ฐ ๋ ๋๊น์ง, ๋๋จธ์ง ์์ด์ฝ๋ค์ ์
๋ฐ์ดํธ ํด ๋๊ฐ๋ค.
#4 ์์ฑ๋ ์ฑ
#4-1 ์ด ๊ฒ์๊ธ ์์ ์ Commit
GitHub - Kanmanemone/nutri-capture-new
Contribute to Kanmanemone/nutri-capture-new development by creating an account on GitHub.
github.com
#4-2 ๋ณธ ํ๋ก์ ํธ์ ๊ฐ์ฅ ์ต์ Commit
GitHub - Kanmanemone/nutri-capture-new
Contribute to Kanmanemone/nutri-capture-new development by creating an account on GitHub.
github.com
'๊ฐ๋ฐ ์ผ์ง ๐ป > Nutri Capture' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Nutri Capture ํ๋ก ํธ์๋ - windowInsetsPadding() (0) | 2025.01.29 |
---|---|
Nutri Capture - ์ฝ๋ ์ ๋ฆฌ (0) | 2025.01.29 |
Nutri Capture ๋ฐฑ์๋ - StateFlow๋ก ์ ํ (0) | 2025.01.02 |
Nutri Capture ๋ฐฑ์๋ - ChatBar์ ViewModel ์ฐ๊ฒฐ (0) | 2025.01.02 |
Nutri Capture ๋ฐฉํฅ์ฑ - ๊ฐ๋ฐ ์ผ์ ํ (1์ฐจ) (0) | 2024.12.31 |