Center buttons

main
CAPEL Maxime 2024-01-12 13:15:44 +01:00
parent 9338603c73
commit ada54c65dc
2 changed files with 18 additions and 13 deletions

View File

@ -188,8 +188,7 @@ fun glossaryList(glossaries: List<Glossary>, 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<Glossary>, 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<Project>, 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<Project>, 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<Project>, onProjectSelected: (Project) -> Unit, o
buttonComponent("Retour", onBackClick)
}
}
}

View File

@ -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()