diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/MainActivity.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/MainActivity.kt index 9dfbfbe..2417309 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/MainActivity.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/MainActivity.kt @@ -25,7 +25,7 @@ class MainActivity : ComponentActivity() { What_The_FantasyTheme { //AppNavigator() //QuizPage() - QuotePage(QuoteStub.quote15) + QuotePage(QuoteStub.quote1) } } } diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/navigations/AppNavigator.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/navigations/AppNavigator.kt index d7c38e5..0c651c1 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/navigations/AppNavigator.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/navigations/AppNavigator.kt @@ -4,6 +4,7 @@ import androidx.compose.runtime.Composable import androidx.navigation.compose.NavHost import androidx.navigation.compose.composable import androidx.navigation.compose.rememberNavController +import com.example.what_the_fantasy.data.model.Quote import com.example.what_the_fantasy.ui.screens.AccueilPage import com.example.what_the_fantasy.ui.screens.FavoritePage import com.example.what_the_fantasy.ui.screens.LoginPage @@ -51,7 +52,7 @@ fun AppNavigator() { ProfilPage(index = userIndex, navController = navController) } composable(Destination.Quiz.route) { QuizPage(navController) } - composable(Destination.Quote.route) { QuotePage() } + composable(Destination.Quote.route) { } composable(Destination.Search.route) { SearchPage() } composable(Destination.SignUp.route) { SignUpPage(navController) } composable(Destination.SubmitQuote.route) { SubmitQuotePage() } diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuotePage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuotePage.kt index 474691c..f9dab91 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuotePage.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuotePage.kt @@ -1,52 +1,88 @@ package com.example.what_the_fantasy.ui.screens +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size +import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.drawBehind import androidx.compose.ui.geometry.CornerRadius import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.TextUnit import androidx.compose.ui.unit.dp import com.example.what_the_fantasy.R import com.example.what_the_fantasy.data.model.Quote +import coil.compose.AsyncImage @Composable fun QuotePage(quote : Quote) { - Column(modifier = Modifier.padding(10.dp).drawBehind { - drawRoundRect( - Color(70,190,115), - cornerRadius = CornerRadius(10.dp.toPx()) - ) - }.size(500.dp, 600.dp)) +// Column (modifier = Modifier.padding(15.dp).drawBehind { +// drawRoundRect( +// Color(70,190,115), +// cornerRadius = CornerRadius(15.dp.toPx()), +// ) +// }.size(500.dp, 600.dp)) + Box { - Text( - text = '"'+quote.content+'"' - - ) - InfoQuoteText( - nameId = R.string.source, - text = quote.source - ) - InfoQuoteText( - nameId = R.string.charac, - text = quote.character - ) - Text( - text = "like : " + quote.likes.toString() - ) + Row(modifier = Modifier.padding(15.dp)){ + ImageQuote( + imageUrl = quote.imgUrl + ) + QuoteText( + text = '"'+quote.content+'"' + ) + } + Column (modifier = Modifier.padding(15.dp)) { + InfoQuoteText( + nameId = R.string.source, + text = quote.source + ) + InfoQuoteText( + nameId = R.string.charac, + text = quote.character + ) + Text( + text = "like : " + quote.likes.toString() + ) + } } } +@Composable +fun QuoteText(text: String ){ + Text( + text = text, + modifier = Modifier.padding(start = 10.dp, top = 15.dp), + fontWeight = FontWeight(1000) + ) +} + +@Composable +fun ImageQuote(imageUrl : String){ + AsyncImage( + model = imageUrl, + contentDescription = "Photo de profil", + modifier = Modifier + .size(150.dp) + .clip(RoundedCornerShape(15.dp)) + ) +} + @Composable fun InfoQuoteText(nameId : Int, text : String){ - Column{ + Column(modifier = Modifier.padding(bottom = 40.dp)){ Text( - text = stringResource(id = nameId) + text = stringResource(id = nameId), + fontWeight = FontWeight(500) ) Text( @@ -58,7 +94,7 @@ fun InfoQuoteText(nameId : Int, text : String){ cornerRadius = CornerRadius(15.dp.toPx()) ) } - .padding(5.dp) + .padding(5.dp), ) } } \ No newline at end of file