From f611891c090a7e8df5d194f483bb233c1d9eca9f Mon Sep 17 00:00:00 2001 From: CAPEL Maxime <83071634+fortyup@users.noreply.github.com> Date: Fri, 12 Jan 2024 09:58:35 +0100 Subject: [PATCH] Add word button on glossary detailed view --- src/main/kotlin/main/Detail.kt | 9 +++++++-- src/main/kotlin/main/Main.kt | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/main/Detail.kt b/src/main/kotlin/main/Detail.kt index 873ba7b..88d9c25 100644 --- a/src/main/kotlin/main/Detail.kt +++ b/src/main/kotlin/main/Detail.kt @@ -9,7 +9,7 @@ import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.material.MaterialTheme import androidx.compose.material.Text import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.ArrowBack +import androidx.compose.material.icons.filled.* import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -19,7 +19,11 @@ import androidx.compose.ui.unit.dp import main.component.buttonComponent @Composable -fun glossaryDetailedPage(glossary: List, onBackClick: () -> Unit) { +fun glossaryDetailedPage( + glossary: List, + onBackClick: () -> Unit, + onAddWordClick: () -> Unit +) { Column( modifier = Modifier.fillMaxSize(), verticalArrangement = Arrangement.Top, // Align content at the top @@ -34,6 +38,7 @@ fun glossaryDetailedPage(glossary: List, onBackClick: () -> Unit) { Spacer(modifier = Modifier.height(16.dp)) buttonComponent(text = "Retour", onClick = { onBackClick() }, icon = Icons.Filled.ArrowBack, width = 150) + buttonComponent(text = "Ajouter un mot", onClick = { onAddWordClick() }, icon = Icons.Filled.Add, width = 150) } } diff --git a/src/main/kotlin/main/Main.kt b/src/main/kotlin/main/Main.kt index 51ec064..1d0ab9f 100644 --- a/src/main/kotlin/main/Main.kt +++ b/src/main/kotlin/main/Main.kt @@ -330,7 +330,8 @@ fun app() { "glossaireDetail" -> { glossaryDetailedPage( glossary = glossaryDetail, - onBackClick = { currentPage.value = "glossaireOptions" } + onBackClick = { currentPage.value = "glossaireOptions" }, + onAddWordClick = { currentPage.value = "formulaire" }, ) }