Add stickyHeader for compare view

main
CAPEL Maxime 2023-12-20 09:25:37 +01:00
parent b1bb3a1319
commit 5f358bf772
2 changed files with 15 additions and 13 deletions

View File

@ -1,5 +1,6 @@
package main package main
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.border import androidx.compose.foundation.border
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
@ -33,12 +34,6 @@ 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(
@ -48,9 +43,16 @@ fun compareResults(
) { ) {
Text("Retour") Text("Retour")
} }
Spacer(modifier = Modifier.height(16.dp))
commonWordsTable(glossaryWords, codeWords)
Spacer(modifier = Modifier.height(16.dp))
} }
} }
@OptIn(ExperimentalFoundationApi::class)
@Composable @Composable
fun commonWordsTable( fun commonWordsTable(
glossaryWords: List<Word>, glossaryWords: List<Word>,
@ -61,7 +63,7 @@ fun commonWordsTable(
LazyColumn( LazyColumn(
modifier = Modifier.fillMaxSize().padding(16.dp), modifier = Modifier.fillMaxSize().padding(16.dp),
content = { content = {
item { stickyHeader {
commonWordsHeaderRow() commonWordsHeaderRow()
} }
items(glossaryWords) { word -> items(glossaryWords) { word ->

View File

@ -28,12 +28,6 @@ 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(
@ -44,6 +38,12 @@ 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))
} }
} }