From ada54c65dcdcff792522318ebe9627d34d5177ea Mon Sep 17 00:00:00 2001 From: CAPEL Maxime <83071634+fortyup@users.noreply.github.com> Date: Fri, 12 Jan 2024 13:15:44 +0100 Subject: [PATCH] Center buttons --- src/main/kotlin/main/Home.kt | 26 +++++++++---------- .../kotlin/main/{projects.kt => Projects.kt} | 5 ++++ 2 files changed, 18 insertions(+), 13 deletions(-) rename src/main/kotlin/main/{projects.kt => Projects.kt} (98%) diff --git a/src/main/kotlin/main/Home.kt b/src/main/kotlin/main/Home.kt index 5b97bb9..67cb969 100644 --- a/src/main/kotlin/main/Home.kt +++ b/src/main/kotlin/main/Home.kt @@ -188,8 +188,7 @@ fun glossaryList(glossaries: List, onGlossarySelected: (Glossary) -> U state = scrollState, modifier = Modifier .padding(10.dp) - .width(200.dp) - .height(300.dp), + .width(200.dp), verticalArrangement = Arrangement.spacedBy(10.dp) ) { if (glossaries.isEmpty()) { @@ -200,9 +199,10 @@ fun glossaryList(glossaries: List, onGlossarySelected: (Glossary) -> U items(glossaries) { glossary -> Row( modifier = Modifier.width(200.dp).fillMaxWidth(), - horizontalArrangement = Arrangement.SpaceBetween + horizontalArrangement = Arrangement.SpaceBetween, + verticalAlignment = Alignment.CenterVertically ) { - buttonComponent(glossary.name, { onGlossarySelected(glossary) }, width = 150) + buttonComponent(glossary.name, { onGlossarySelected(glossary) }, width = 200) } } } @@ -226,14 +226,14 @@ fun projectList(projects: List, onProjectSelected: (Project) -> Unit, o verticalArrangement = Arrangement.Center, horizontalAlignment = Alignment.CenterHorizontally ) { - Text("Sélectionnez un Projet", style = MaterialTheme.typography.h5) + Text("Sélectionnez un projet", style = MaterialTheme.typography.h5) Spacer(modifier = Modifier.height(16.dp)) Box( modifier = Modifier .height(500.dp) - .width(350.dp) + .width(250.dp) .padding(10.dp) ) { val scrollState = rememberLazyListState() @@ -241,21 +241,21 @@ fun projectList(projects: List, onProjectSelected: (Project) -> Unit, o state = scrollState, modifier = Modifier .padding(10.dp) - .width(250.dp) - .height(300.dp), + .width(200.dp), verticalArrangement = Arrangement.spacedBy(10.dp) ) { if (projects.isEmpty()) { item { - Text("Aucun projet disponible") + Text("Aucun glossaire disponible") } } else { - items(projects) { project: Project -> + items(projects) { project -> Row( modifier = Modifier.width(200.dp).fillMaxWidth(), - horizontalArrangement = Arrangement.SpaceBetween + horizontalArrangement = Arrangement.SpaceBetween, + verticalAlignment = Alignment.CenterVertically ) { - buttonComponent(project.name, { onProjectSelected(project) }, width = 150) + buttonComponent(project.name, { onProjectSelected(project) }, width = 200) } } } @@ -270,4 +270,4 @@ fun projectList(projects: List, onProjectSelected: (Project) -> Unit, o buttonComponent("Retour", onBackClick) } -} +} \ No newline at end of file diff --git a/src/main/kotlin/main/projects.kt b/src/main/kotlin/main/Projects.kt similarity index 98% rename from src/main/kotlin/main/projects.kt rename to src/main/kotlin/main/Projects.kt index 8cfb571..da23a77 100644 --- a/src/main/kotlin/main/projects.kt +++ b/src/main/kotlin/main/Projects.kt @@ -150,6 +150,11 @@ fun newProject( singleLine = true, onValueChange = { projectName = it }, label = { Text("Nom du projet") }, + colors = TextFieldDefaults.textFieldColors( + focusedIndicatorColor = customRedColor, + unfocusedIndicatorColor = Color.Gray, + focusedLabelColor = customRedColor + ), modifier = Modifier .width(300.dp) .fillMaxWidth()