Add scroll for views

main
CAPEL Maxime 2023-12-20 09:38:47 +01:00
parent 5f358bf772
commit 71bd09e88f
4 changed files with 58 additions and 32 deletions

View File

@ -34,6 +34,12 @@ fun compareResults(
style = MaterialTheme.typography.h3 style = MaterialTheme.typography.h3
) )
Spacer(modifier = Modifier.height(16.dp))
commonWordsTable(glossaryWords, codeWords)
Spacer(modifier = Modifier.height(16.dp))
Button( Button(
onClick = onBackClick, onClick = onBackClick,
colors = androidx.compose.material.ButtonDefaults.buttonColors( colors = androidx.compose.material.ButtonDefaults.buttonColors(
@ -43,12 +49,6 @@ fun compareResults(
) { ) {
Text("Retour") Text("Retour")
} }
Spacer(modifier = Modifier.height(16.dp))
commonWordsTable(glossaryWords, codeWords)
Spacer(modifier = Modifier.height(16.dp))
} }
} }
@ -60,6 +60,13 @@ fun commonWordsTable(
) { ) {
val glossaryWordsSet = glossaryWords.map { it.name }.toSet() val glossaryWordsSet = glossaryWords.map { it.name }.toSet()
Box(
modifier = Modifier
// Les 3/4 de l'écran
.height(500.dp)
.padding(10.dp)
) {
LazyColumn( LazyColumn(
modifier = Modifier.fillMaxSize().padding(16.dp), modifier = Modifier.fillMaxSize().padding(16.dp),
content = { content = {
@ -77,6 +84,7 @@ fun commonWordsTable(
} }
) )
} }
}
@Composable @Composable
fun commonWordsHeaderRow() { fun commonWordsHeaderRow() {

View File

@ -28,6 +28,12 @@ fun glossaryDetailedPage(glossary: List<Word>, onBackClick: () -> Unit) {
) { ) {
Text(text = "Détail du glossaire", style = MaterialTheme.typography.h3) Text(text = "Détail du glossaire", style = MaterialTheme.typography.h3)
Spacer(modifier = Modifier.height(16.dp))
glossaryTable(glossary = glossary)
Spacer(modifier = Modifier.height(16.dp))
Button( Button(
onClick = { onBackClick() }, onClick = { onBackClick() },
colors = androidx.compose.material.ButtonDefaults.buttonColors( colors = androidx.compose.material.ButtonDefaults.buttonColors(
@ -38,12 +44,6 @@ fun glossaryDetailedPage(glossary: List<Word>, onBackClick: () -> Unit) {
Icon(imageVector = Icons.Default.ArrowBack, contentDescription = null) Icon(imageVector = Icons.Default.ArrowBack, contentDescription = null)
Text("Retour") Text("Retour")
} }
Spacer(modifier = Modifier.height(16.dp))
glossaryTable(glossary = glossary)
Spacer(modifier = Modifier.height(16.dp))
} }
} }
@ -51,6 +51,11 @@ fun glossaryDetailedPage(glossary: List<Word>, onBackClick: () -> Unit) {
@Composable @Composable
fun glossaryTable(glossary: List<Word>) { fun glossaryTable(glossary: List<Word>) {
val listState = rememberLazyListState() val listState = rememberLazyListState()
Box(
modifier = Modifier
.height(500.dp)
.padding(10.dp)
) {
LazyColumn(state = listState, modifier = Modifier.padding(16.dp)) { LazyColumn(state = listState, modifier = Modifier.padding(16.dp)) {
item { item {
headerRow() headerRow()
@ -60,6 +65,7 @@ fun glossaryTable(glossary: List<Word>) {
} }
} }
} }
}
@Composable @Composable

View File

@ -151,6 +151,11 @@ fun GlossaryList(glossaries: List<Glossary>, onGlossarySelected: (Glossary) -> U
Spacer(modifier = Modifier.height(16.dp)) Spacer(modifier = Modifier.height(16.dp))
Box(
modifier = Modifier
.height(500.dp)
.padding(10.dp)
) {
LazyColumn( LazyColumn(
modifier = Modifier.padding(10.dp), modifier = Modifier.padding(10.dp),
verticalArrangement = Arrangement.spacedBy(10.dp) verticalArrangement = Arrangement.spacedBy(10.dp)
@ -177,4 +182,5 @@ fun GlossaryList(glossaries: List<Glossary>, onGlossarySelected: (Glossary) -> U
Spacer(modifier = Modifier.height(6.dp)) Spacer(modifier = Modifier.height(6.dp))
} }
}
} }

View File

@ -66,6 +66,11 @@ fun app() {
Spacer(modifier = Modifier.height(16.dp)) Spacer(modifier = Modifier.height(16.dp))
Box(
modifier = Modifier
.height(300.dp)
.padding(10.dp)
) {
LazyColumn( LazyColumn(
modifier = Modifier.padding(10.dp), modifier = Modifier.padding(10.dp),
verticalArrangement = Arrangement.spacedBy(10.dp) verticalArrangement = Arrangement.spacedBy(10.dp)
@ -103,6 +108,7 @@ fun app() {
} }
} }
} }
}
Spacer(modifier = Modifier.height(16.dp)) Spacer(modifier = Modifier.height(16.dp))
// mettre un texte "ou" // mettre un texte "ou"