Skip to content

Commit

Permalink
[feature] 설정화면 뒤로가기 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
jiwon2724 committed Aug 25, 2024
1 parent 4b55225 commit d768d42
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ fun RootNavHost(
val viewModel: SettingViewModel = hiltViewModel()
SettingsScreen(
settingViewModel = viewModel,
onBackPressed = navHostController::popBackStack,
onNavigateToEditNickname = { navHostController.navigate(EditNickname.route) },
onNavigateToLogin = {
navHostController.navigate(Login.route) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ import pokitmons.pokit.core.ui.R.drawable as DrawableResource
import pokitmons.pokit.settings.R.string as StringResource

@Composable
fun SettingHeader() {
fun SettingHeader(
onBackPressed: () -> Unit,
) {
Box(
modifier = Modifier
.fillMaxWidth()
Expand All @@ -31,7 +33,7 @@ fun SettingHeader() {
contentDescription = null,
modifier = Modifier
.align(Alignment.CenterStart)
.noRippleClickable { }
.noRippleClickable { onBackPressed() }
.size(24.dp)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ fun SettingsScreen(
settingViewModel: SettingViewModel,
onNavigateToEditNickname: () -> Unit,
onNavigateToLogin: () -> Unit,
onBackPressed: () -> Unit,
) {
val context = LocalContext.current

Expand All @@ -38,7 +39,7 @@ fun SettingsScreen(
}

Column(modifier = Modifier.fillMaxWidth()) {
SettingHeader()
SettingHeader(onBackPressed)
Spacer(modifier = Modifier.height(16.dp))
Column(modifier = Modifier.fillMaxWidth()) {
SettingItem(title = stringResource(StringResource.nickname_settings)) {
Expand Down

0 comments on commit d768d42

Please sign in to comment.