diff --git a/app/src/main/java/pokitmons/pokit/navigation/RootNavHost.kt b/app/src/main/java/pokitmons/pokit/navigation/RootNavHost.kt index 63fa6064..eec5f8d4 100644 --- a/app/src/main/java/pokitmons/pokit/navigation/RootNavHost.kt +++ b/app/src/main/java/pokitmons/pokit/navigation/RootNavHost.kt @@ -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) { diff --git a/feature/settings/src/main/java/pokitmons/pokit/settings/setting/SettingHeader.kt b/feature/settings/src/main/java/pokitmons/pokit/settings/setting/SettingHeader.kt index 66cfe8a7..53a0e259 100644 --- a/feature/settings/src/main/java/pokitmons/pokit/settings/setting/SettingHeader.kt +++ b/feature/settings/src/main/java/pokitmons/pokit/settings/setting/SettingHeader.kt @@ -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() @@ -31,7 +33,7 @@ fun SettingHeader() { contentDescription = null, modifier = Modifier .align(Alignment.CenterStart) - .noRippleClickable { } + .noRippleClickable { onBackPressed() } .size(24.dp) ) diff --git a/feature/settings/src/main/java/pokitmons/pokit/settings/setting/SettingsScreen.kt b/feature/settings/src/main/java/pokitmons/pokit/settings/setting/SettingsScreen.kt index ce330b9e..a5db85da 100644 --- a/feature/settings/src/main/java/pokitmons/pokit/settings/setting/SettingsScreen.kt +++ b/feature/settings/src/main/java/pokitmons/pokit/settings/setting/SettingsScreen.kt @@ -25,6 +25,7 @@ fun SettingsScreen( settingViewModel: SettingViewModel, onNavigateToEditNickname: () -> Unit, onNavigateToLogin: () -> Unit, + onBackPressed: () -> Unit, ) { val context = LocalContext.current @@ -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)) {