From 856cd6094d5d6937b0abf7a8fdd384db4220b80b Mon Sep 17 00:00:00 2001 From: ByrmGkcn Date: Fri, 12 Jan 2024 13:57:29 +0100 Subject: [PATCH] help tuto --- src/main/kotlin/main/Help.kt | 47 ++++++++++++++++++++++++ src/main/kotlin/main/Home.kt | 18 +++++++++ src/main/kotlin/main/component/Button.kt | 2 - 3 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 src/main/kotlin/main/Help.kt diff --git a/src/main/kotlin/main/Help.kt b/src/main/kotlin/main/Help.kt new file mode 100644 index 0000000..d61f4bb --- /dev/null +++ b/src/main/kotlin/main/Help.kt @@ -0,0 +1,47 @@ +package main + +import androidx.compose.foundation.layout.* +import androidx.compose.material.* +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import main.component.buttonComponent + +@Composable +fun HelpPage(onBackClick: () -> Unit) { + Column( + modifier = Modifier + .fillMaxSize() + .padding(16.dp), + verticalArrangement = Arrangement.Center, + horizontalAlignment = Alignment.CenterHorizontally + ) { + Text("Bienvenue dans l'aide !", style = MaterialTheme.typography.h4) + + Spacer(modifier = Modifier.height(16.dp)) + + Text("Contenu de l'aide...") + + Spacer(modifier = Modifier.height(16.dp)) + + buttonComponent("OK", onBackClick) + } +} + +@Composable +fun HelpButton(onHelpClick: () -> Unit) { + Box( + modifier = Modifier + .fillMaxSize() + .padding(16.dp), + contentAlignment = Alignment.BottomEnd + ) { + IconButton( + onClick = onHelpClick + ) { + Text("?", fontSize = 24.sp) + } + } +} diff --git a/src/main/kotlin/main/Home.kt b/src/main/kotlin/main/Home.kt index 67cb969..4a92aca 100644 --- a/src/main/kotlin/main/Home.kt +++ b/src/main/kotlin/main/Home.kt @@ -31,6 +31,24 @@ fun homePage( var isCompareClicked by remember { mutableStateOf(false) } var selectedGlossary by remember { mutableStateOf(null) } + var showHelpPage by remember { mutableStateOf(false) } + + + if (showHelpPage) { + HelpPage { + // Retour depuis la page d'aide + showHelpPage = false + print("Retour depuis la page d'aide") + } + } else { + + HelpButton { + showHelpPage = true + } + + + } + if (!isCompareClicked && selectedGlossary == null) { // Utilisez un Box pour placer le drapeau en haut à droite Box( diff --git a/src/main/kotlin/main/component/Button.kt b/src/main/kotlin/main/component/Button.kt index 5dfa9af..952f3cb 100644 --- a/src/main/kotlin/main/component/Button.kt +++ b/src/main/kotlin/main/component/Button.kt @@ -9,8 +9,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import androidx.compose.material.Icon -import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.ArrowBack import androidx.compose.ui.graphics.vector.ImageVector import main.customRedColor