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
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.*
@ -33,12 +34,6 @@ fun compareResults(
style = MaterialTheme.typography.h3
)
Spacer(modifier = Modifier.height(16.dp))
commonWordsTable(glossaryWords, codeWords)
Spacer(modifier = Modifier.height(16.dp))
Button(
onClick = onBackClick,
colors = androidx.compose.material.ButtonDefaults.buttonColors(
@ -48,9 +43,16 @@ fun compareResults(
) {
Text("Retour")
}
Spacer(modifier = Modifier.height(16.dp))
commonWordsTable(glossaryWords, codeWords)
Spacer(modifier = Modifier.height(16.dp))
}
}
@OptIn(ExperimentalFoundationApi::class)
@Composable
fun commonWordsTable(
glossaryWords: List<Word>,
@ -61,7 +63,7 @@ fun commonWordsTable(
LazyColumn(
modifier = Modifier.fillMaxSize().padding(16.dp),
content = {
item {
stickyHeader {
commonWordsHeaderRow()
}
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)
Spacer(modifier = Modifier.height(16.dp))
glossaryTable(glossary = glossary)
Spacer(modifier = Modifier.height(16.dp))
Button(
onClick = { onBackClick() },
colors = androidx.compose.material.ButtonDefaults.buttonColors(
@ -44,6 +38,12 @@ fun glossaryDetailedPage(glossary: List<Word>, onBackClick: () -> Unit) {
Icon(imageVector = Icons.Default.ArrowBack, contentDescription = null)
Text("Retour")
}
Spacer(modifier = Modifier.height(16.dp))
glossaryTable(glossary = glossary)
Spacer(modifier = Modifier.height(16.dp))
}
}