Skip to content

Commit

Permalink
🚚 ViewType 과 Gradient 를 별도의 Composable 로 분리
Browse files Browse the repository at this point in the history
  • Loading branch information
JeonK1 committed Oct 4, 2024
1 parent c445c0e commit 3533b4a
Showing 1 changed file with 41 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxScope
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
Expand Down Expand Up @@ -184,35 +185,10 @@ fun GroupHomeScreen(
filterTagList = filterTagList,
onTagClicked = onClickFilterTag,
)
Box(
modifier = Modifier
.width(100.dp)
.wrapContentHeight()
.background(
brush = Brush.linearGradient(
listOf(
Color.Transparent,
Gray0,
Gray0,
),
),
)
.align(Alignment.CenterEnd),
) {
ViewTypeButton(
modifier = Modifier
.noRippleClickable {
when (currentViewType) {
ViewType.List -> onClickViewType(ViewType.Grid)
ViewType.Grid -> onClickViewType(ViewType.List)
}
}
.padding(top = 11.dp, bottom = 11.dp, end = 20.dp)
.wrapContentSize()
.align(Alignment.CenterEnd),
currentViewType = currentViewType,
)
}
ViewTypeWithGradient(
currentViewType = currentViewType,
onClickViewType = onClickViewType,
)
}

Spacer(
Expand Down Expand Up @@ -254,6 +230,42 @@ fun GroupHomeScreen(
}
}

@Composable
private fun BoxScope.ViewTypeWithGradient(
currentViewType: ViewType,
onClickViewType: (ViewType) -> Unit,
) {
Box(
modifier = Modifier
.width(100.dp)
.wrapContentHeight()
.background(
brush = Brush.linearGradient(
listOf(
Color.Transparent,
Gray0,
Gray0,
),
),
)
.align(Alignment.CenterEnd),
) {
ViewTypeButton(
modifier = Modifier
.noRippleClickable {
when (currentViewType) {
ViewType.List -> onClickViewType(ViewType.Grid)
ViewType.Grid -> onClickViewType(ViewType.List)
}
}
.padding(top = 11.dp, bottom = 11.dp, end = 20.dp)
.wrapContentSize()
.align(Alignment.CenterEnd),
currentViewType = currentViewType,
)
}
}

@Composable
private fun ViewTypeButton(
modifier: Modifier,
Expand Down

0 comments on commit 3533b4a

Please sign in to comment.