@ -37,40 +37,40 @@ import com.example.veraxapplication.modele.articles.contenus.ContenuParagraphe
import com.example.veraxapplication.ui.theme.Salmon
@Composable
fun AffichageLesArticles ( articles : List < Article > ){
fun AffichageLesArticles ( articles : List < Article > , goToArticle : ( Article ) -> Unit ){
Column ( modifier = Modifier . verticalScroll ( rememberScrollState ( ) ) ) {
for ( article in articles ) {
Box (Modifier . clickable { /*faut je regarde la doc*/ } ) {
AffichageUnArticleInfo ( e = article )
Box {
AffichageUnArticleInfo ( e = article , goToArticle )
}
}
}
}
@Composable
fun AffichageUnArticleInfo ( e : Article ){
fun AffichageUnArticleInfo ( e : Article , goToArticle : ( Article ) -> Unit ){
Column ( modifier = Modifier
. padding ( 7. dp )
. border ( width = 1. dp , color = Color . Black , shape = RoundedCornerShape ( 10. dp ) )
. padding ( 5. dp ) ) {
/ * DisplayTitle ( title = e . Title )
DisplayHeader ( author = e . Author , description = e . Description , lectureTime = e . LectureTime )
DisplayImage ( image = e . Image )
DisplayContentArticle ( content = e . Content ) * /
Text ( text = e . titre , fontFamily = FontFamily . Serif , fontSize = 30. sp )
DisplayHeader ( author = e . auteur , description = e . description , lectureTime = e . temps )
var imageURl = e . imagePrincipale
Log . d ( " ImageLoad " , " URL de l'image reçue de l'API : $imageURl " )
Box ( modifier = Modifier
. padding ( 15. dp )
. border ( width = 1. dp , color = Color . Black , shape = RoundedCornerShape ( 10. dp ) )
. clip ( RoundedCornerShape ( 10. dp ) )
. background ( Salmon )
) {
Column ( modifier = Modifier . padding ( 15. dp ) ) {
Text ( text = " Auteur : " + e . auteur , fontSize = 17. sp )
Text ( text = " Description : " + e . description , fontSize = 17. sp )
Text ( text = " Temps de lecture : " + e . temps + " minutes " , fontSize = 17. sp )
}
}
Image (
painter = rememberImagePainter (
data = imageURl
data = e. imagePrincipale
) ,
contentScale = ContentScale . Crop ,
contentDescription = null ,
@ -79,15 +79,16 @@ fun AffichageUnArticleInfo(e : Article){
. align ( Alignment . CenterHorizontally )
. padding ( 5. dp , 35. dp )
)
Button ( onClick = { /*TODO*/ } ,
Button ( onClick = { goToArticle ( e ) } ,
colors = ButtonDefaults . buttonColors (
containerColor = Salmon ,
contentColor = Color . Black
) ,
containerColor = Salmon ,
contentColor = Color . Black
) ,
border = BorderStroke ( 1. dp , Color . Black ) ,
modifier = Modifier
. align ( Alignment . CenterHorizontally )
modifier = Modifier
. align ( Alignment . CenterHorizontally )
) {
Text ( text = " Voir plus " )
}
@ -107,25 +108,23 @@ fun AfficherArticle(e : Article){
// Affichage des informations de l'article
DisplayHeader ( author = e . auteur , description = e . description , lectureTime = e . temps )
Text ( text = " coucou " )
/ *
Image (
painter = rememberImagePainter ( data = e . imagePrincipale ) ,
contentScale = ContentScale . FillHeight ,
painter = rememberImagePainter (
data = e . imagePrincipale
) ,
contentScale = ContentScale . Crop ,
contentDescription = null ,
modifier = Modifier
. size ( 350. dp )
. align ( Alignment . CenterHorizontally )
. padding ( 5. dp , 35. dp )
. fillMaxWidth ( )
. wrapContentWidth ( Alignment . CenterHorizontally )
) * /
)
// Affichage contenus
//DisplayContenu(e.lContenus)
DisplayContenu ( e . lContenus )
}
}