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, state = scrollState,
modifier = Modifier modifier = Modifier
.padding(10.dp) .padding(10.dp)
.width(200.dp) .width(200.dp),
.height(300.dp),
verticalArrangement = Arrangement.spacedBy(10.dp) verticalArrangement = Arrangement.spacedBy(10.dp)
) { ) {
if (glossaries.isEmpty()) { if (glossaries.isEmpty()) {
@ -200,9 +199,10 @@ fun glossaryList(glossaries: List<Glossary>, onGlossarySelected: (Glossary) -> U
items(glossaries) { glossary -> items(glossaries) { glossary ->
Row( Row(
modifier = Modifier.width(200.dp).fillMaxWidth(), 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, verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally 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)) Spacer(modifier = Modifier.height(16.dp))
Box( Box(
modifier = Modifier modifier = Modifier
.height(500.dp) .height(500.dp)
.width(350.dp) .width(250.dp)
.padding(10.dp) .padding(10.dp)
) { ) {
val scrollState = rememberLazyListState() val scrollState = rememberLazyListState()
@ -241,21 +241,21 @@ fun projectList(projects: List<Project>, onProjectSelected: (Project) -> Unit, o
state = scrollState, state = scrollState,
modifier = Modifier modifier = Modifier
.padding(10.dp) .padding(10.dp)
.width(250.dp) .width(200.dp),
.height(300.dp),
verticalArrangement = Arrangement.spacedBy(10.dp) verticalArrangement = Arrangement.spacedBy(10.dp)
) { ) {
if (projects.isEmpty()) { if (projects.isEmpty()) {
item { item {
Text("Aucun projet disponible") Text("Aucun glossaire disponible")
} }
} else { } else {
items(projects) { project: Project -> items(projects) { project ->
Row( Row(
modifier = Modifier.width(200.dp).fillMaxWidth(), 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)
} }
} }
} }

View File

@ -150,6 +150,11 @@ fun newProject(
singleLine = true, singleLine = true,
onValueChange = { projectName = it }, onValueChange = { projectName = it },
label = { Text("Nom du projet") }, label = { Text("Nom du projet") },
colors = TextFieldDefaults.textFieldColors(
focusedIndicatorColor = customRedColor,
unfocusedIndicatorColor = Color.Gray,
focusedLabelColor = customRedColor
),
modifier = Modifier modifier = Modifier
.width(300.dp) .width(300.dp)
.fillMaxWidth() .fillMaxWidth()