From 5f358bf772730f384b12384264ac55b9ff9d4bb9 Mon Sep 17 00:00:00 2001 From: CAPEL Maxime <83071634+fortyup@users.noreply.github.com> Date: Wed, 20 Dec 2023 09:25:37 +0100 Subject: [PATCH] Add stickyHeader for compare view --- src/main/kotlin/main/Compare.kt | 16 +++++++++------- src/main/kotlin/main/Detail.kt | 12 ++++++------ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/main/kotlin/main/Compare.kt b/src/main/kotlin/main/Compare.kt index 3db8c67..ac3eaf8 100644 --- a/src/main/kotlin/main/Compare.kt +++ b/src/main/kotlin/main/Compare.kt @@ -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, @@ -61,7 +63,7 @@ fun commonWordsTable( LazyColumn( modifier = Modifier.fillMaxSize().padding(16.dp), content = { - item { + stickyHeader { commonWordsHeaderRow() } items(glossaryWords) { word -> diff --git a/src/main/kotlin/main/Detail.kt b/src/main/kotlin/main/Detail.kt index f4c0775..a9c4350 100644 --- a/src/main/kotlin/main/Detail.kt +++ b/src/main/kotlin/main/Detail.kt @@ -28,12 +28,6 @@ fun glossaryDetailedPage(glossary: List, 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, 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)) } }