Skip to content

Commit

Permalink
[#5] Apply code from review
Browse files Browse the repository at this point in the history
  • Loading branch information
Wadeewee committed Aug 18, 2022
1 parent 7b1bc5e commit 1c2e973
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ fun CoinItem(
.wrapContentWidth()
.clip(RoundedCornerShape(Dp12))
.background(color = MaterialTheme.colors.coinItemColor)
.padding(horizontal = Dp8, vertical = Dp8)
) {
val (
logo,
Expand All @@ -57,7 +58,7 @@ fun CoinItem(
Image(
modifier = Modifier
.size(Dp60)
.padding(start = Dp8, end = Dp16, top = Dp8)
.padding(end = Dp16)
.constrainAs(logo) {
top.linkTo(coinSymbol.top)
bottom.linkTo(coinName.bottom)
Expand All @@ -70,7 +71,6 @@ fun CoinItem(

Text(
modifier = Modifier
.padding(end = Dp8, top = Dp8)
.constrainAs(coinSymbol) {
top.linkTo(parent.top)
start.linkTo(logo.end)
Expand All @@ -83,7 +83,7 @@ fun CoinItem(

Text(
modifier = Modifier
.padding(end = Dp8, top = Dp4)
.padding(top = Dp4)
.constrainAs(coinName) {
start.linkTo(coinSymbol.start)
top.linkTo(coinSymbol.bottom)
Expand All @@ -97,7 +97,7 @@ fun CoinItem(

Text(
modifier = Modifier
.padding(start = Dp8, end = Dp8, top = Dp22, bottom = Dp8)
.padding(top = Dp22)
.constrainAs(price) {
start.linkTo(logo.start)
top.linkTo(coinName.bottom)
Expand All @@ -111,7 +111,7 @@ fun CoinItem(

Icon(
modifier = Modifier
.padding(start = Dp25, bottom = Dp8)
.padding(start = Dp25)
.constrainAs(icon) {
start.linkTo(price.end)
top.linkTo(priceChange.top)
Expand All @@ -125,7 +125,6 @@ fun CoinItem(

Text(
modifier = Modifier
.padding(start = Dp8, end = Dp8, bottom = Dp8)
.constrainAs(priceChange) {
start.linkTo(icon.end)
bottom.linkTo(parent.bottom)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ import co.nimblehq.compose.crypto.ui.theme.Style.textColor
fun HomeScreen() {
Surface {
ConstraintLayout(
modifier = Modifier
.fillMaxSize()
.padding(horizontal = Dp16)
modifier = Modifier.fillMaxSize()
) {
val (
title,
Expand All @@ -38,7 +36,7 @@ fun HomeScreen() {

Text(
modifier = Modifier
.padding(start = Dp16, top = Dp16, end = Dp16)
.padding(top = Dp16)
.constrainAs(title) {
top.linkTo(parent.top)
linkTo(start = parent.start, end = parent.end)
Expand All @@ -51,18 +49,21 @@ fun HomeScreen() {
)

PortfolioCard(
modifier = Modifier.constrainAs(portfolioCard) {
top.linkTo(title.bottom, margin = Dp40)
}
modifier = Modifier
.constrainAs(portfolioCard) {
top.linkTo(title.bottom, margin = Dp40)
}
.padding(horizontal = Dp16)
)

Text(
modifier = Modifier.constrainAs(myCoinsTitle) {
top.linkTo(portfolioCard.bottom, margin = Dp52)
start.linkTo(parent.start)
width = Dimension.preferredWrapContent

},
modifier = Modifier
.constrainAs(myCoinsTitle) {
top.linkTo(portfolioCard.bottom, margin = Dp52)
start.linkTo(parent.start)
width = Dimension.preferredWrapContent
}
.padding(start = Dp16),
text = stringResource(id = R.string.home_my_coins_title),
style = Style.medium16(),
color = MaterialTheme.colors.textColor
Expand All @@ -76,6 +77,7 @@ fun HomeScreen() {
end.linkTo(parent.end)
width = Dimension.preferredWrapContent
}
.padding(end = Dp16)
)

LazyRow(
Expand All @@ -84,7 +86,8 @@ fun HomeScreen() {
.constrainAs(myCoins) {
top.linkTo(myCoinsTitle.bottom, margin = Dp16)
},
horizontalArrangement = Arrangement.spacedBy(Dp16)
contentPadding = PaddingValues(horizontal = Dp16),
horizontalArrangement = Arrangement.spacedBy(Dp16),
) {
// TODO: Remove dummy value when work on Integrate.
item { CoinItem() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ fun PortfolioCard(
colors = listOf(Color.MetallicSeaweed, Color.TiffanyBlue),
)
)
.padding(horizontal = Dp16, vertical = Dp16)
) {
val (
totalCoinsLabel,
Expand All @@ -52,7 +53,6 @@ fun PortfolioCard(

Text(
modifier = Modifier
.padding(top = Dp16, start = Dp16)
.constrainAs(totalCoinsLabel) {
start.linkTo(parent.start)
},
Expand All @@ -62,7 +62,6 @@ fun PortfolioCard(

Text(
modifier = Modifier
.padding(horizontal = Dp16)
.constrainAs(totalCoins) {
top.linkTo(totalCoinsLabel.bottom, margin = Dp8)
},
Expand All @@ -73,7 +72,6 @@ fun PortfolioCard(

Text(
modifier = Modifier
.padding(start = Dp16)
.constrainAs(todayProfitLabel) {
top.linkTo(totalCoins.bottom, margin = Dp40)
},
Expand All @@ -83,7 +81,6 @@ fun PortfolioCard(

Text(
modifier = Modifier
.padding(start = Dp16, bottom = Dp16)
.constrainAs(todayProfit) {
top.linkTo(todayProfitLabel.bottom, margin = Dp8)
},
Expand All @@ -94,7 +91,6 @@ fun PortfolioCard(

Button(
modifier = Modifier
.padding(start = Dp16, end = Dp16, bottom = Dp16)
.shadow(elevation = Dp0)
.constrainAs(profitPercent) {
linkTo(top = todayProfitLabel.top, bottom = todayProfit.bottom)
Expand Down

0 comments on commit 1c2e973

Please sign in to comment.