Skip to content

Commit

Permalink
[Feat]: Screen 연결 후 클릭 시 색상 변화 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
jinuemong committed Jan 28, 2024
1 parent e9bc375 commit d3a45e5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ac.dnd.bookkeeping.android.presentation.ui.main.login.onboarding

class LoginOnBoardingModel(
val state: LoginOnBoardingState
val loadingState: LoginOnBoardingState.Loading,
val buttonState: LoginOnBoardingState.Button
)
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,20 @@ fun LoginOnBoardingScreen(
intent: (LoginOnBoardingIntent) -> Unit,
handler: CoroutineExceptionHandler
) {

var currentSelectedPage by rememberSaveable { mutableIntStateOf(0) }
val pagerState = rememberPagerState(pageCount = { 3 })
val buttonColorState = animateColorAsState(
targetValue = when (model.buttonState) {
is LoginOnBoardingState.Button.Default -> {
Color(0xFFDD55FF)
}

is LoginOnBoardingState.Button.Pressed -> {
Color(0xFFD401FE)
}
},
label = "pressed button color"
)

LaunchedEffect(currentSelectedPage) {
pagerState.animateScrollToPage(currentSelectedPage)
Expand Down Expand Up @@ -87,7 +97,19 @@ fun LoginOnBoardingScreen(
HorizontalPager(
state = pagerState
) { page ->
SampleImageComponent(page.toString())
when (model.loadingState) {
is LoginOnBoardingState.Loading.Progress -> {
SampleImageComponent(page.toString())
}

is LoginOnBoardingState.Loading.Success -> {

}

is LoginOnBoardingState.Loading.Failure -> {

}
}
}
Spacer(Modifier.height(29.18.dp))
Row(
Expand Down Expand Up @@ -125,7 +147,7 @@ fun LoginOnBoardingScreen(
intent(LoginOnBoardingIntent.OnClickNextStep)
},
shape = RoundedCornerShape(8.dp),
color = Color(0xFFDD55FF)
color = buttonColorState.value
) {
Text(
text = stringResource(R.string.next_button_text),
Expand Down Expand Up @@ -170,7 +192,8 @@ fun LoginOnBoardingScreenPreview() {
LoginOnBoardingScreen(
appState = rememberApplicationState(),
model = LoginOnBoardingModel(
state = LoginOnBoardingState.Loading
loadingState = LoginOnBoardingState.Loading.Progress,
buttonState = LoginOnBoardingState.Button.Default
),
event = MutableEventFlow(),
intent = {},
Expand Down

0 comments on commit d3a45e5

Please sign in to comment.