diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/navigations/AppNavigator.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/navigations/AppNavigator.kt index f80a11c..5ab890c 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/navigations/AppNavigator.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/navigations/AppNavigator.kt @@ -106,6 +106,12 @@ fun AppNavigator() { navQuiz = { userIndex -> navController.navigate(Destination.QuizMenu.createRoute(userIndex)) // Passe l'index à Profil }, + navUnLog = { + navController.navigate(Destination.Login.route) { + // Vider pile de navigation pour empêcher le retour à la page profil + popUpTo(Destination.Profil.route) { inclusive = true } + } + }, services = services ) } diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/ProfilPage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/ProfilPage.kt index 57a1fe5..02d00bc 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/ProfilPage.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/ProfilPage.kt @@ -76,6 +76,7 @@ fun ProfilPage(index: Int, navFavorite: (Int) -> Unit, navAccueil: (Int) -> Unit, navQuiz: (Int) -> Unit, + navUnLog: () -> Unit, services: IServices ) { val user = services.getUserById(index) ?: return @@ -122,11 +123,11 @@ fun ProfilPage(index: Int, SpaceHeightComponent(16) // Bouton - ButtonProfile(R.string.ButtonAddQuoteprofile, 18, Color.Black, Color.White) + ButtonProfile(R.string.ButtonAddQuoteprofile, 18, Color.Black, Color.White,navUnLog) // Pas encore de navigation definie SpaceHeightComponent(16) - ButtonProfile(R.string.ButtonLanguageprofile, 18, Color.Black, Color.White) + ButtonProfile(R.string.ButtonLanguageprofile, 18, Color.Black, Color.White,navUnLog) // Pas encore de navigation definie SpaceHeightComponent(16) - ButtonProfile(R.string.ButtonUnlogprofile, 18, Color.Black, Color.White) + ButtonProfile(R.string.ButtonUnlogprofile, 18, Color.Black, Color.White, navUnLog) } } @@ -461,10 +462,10 @@ fun DisplayPassword(onEdit: () -> Unit) { @Composable -fun ButtonProfile(textResId : Int, size :Int, colorTexte : Color, colorButton : Color){ +fun ButtonProfile(textResId : Int, size :Int, colorTexte : Color, colorButton : Color,navController: () -> Unit){ val text = stringResource(id = textResId) Button( - onClick = { /* Action */ }, + onClick = { navController() }, colors = ButtonDefaults.buttonColors(containerColor = colorButton), modifier = Modifier.fillMaxWidth(), ) {