|
|
|
@ -32,6 +32,7 @@ import androidx.compose.material.icons.filled.MailOutline
|
|
|
|
|
import androidx.compose.material.icons.filled.Share
|
|
|
|
|
import androidx.compose.material3.Icon
|
|
|
|
|
import androidx.compose.material3.IconButton
|
|
|
|
|
import androidx.compose.material3.MaterialTheme
|
|
|
|
|
import androidx.compose.material3.Text
|
|
|
|
|
import androidx.compose.material3.TextField
|
|
|
|
|
import androidx.compose.runtime.Composable
|
|
|
|
@ -76,7 +77,10 @@ fun QuotePage(
|
|
|
|
|
// utiliser ViewModel
|
|
|
|
|
val quote = service.getQuote(quoteId) ?: return
|
|
|
|
|
val context = LocalContext.current
|
|
|
|
|
NavBar(onProfile = true,
|
|
|
|
|
val user = service.getUserById(index) ?: return
|
|
|
|
|
val favorite by remember { mutableStateOf(service.isFavorite(id = quoteId, user = user)) }
|
|
|
|
|
|
|
|
|
|
NavBar(
|
|
|
|
|
index = index,
|
|
|
|
|
navControllerFavorite = navFavorite,
|
|
|
|
|
navControllerAccueil = navAccueil,
|
|
|
|
@ -86,17 +90,15 @@ fun QuotePage(
|
|
|
|
|
Box(
|
|
|
|
|
modifier = Modifier
|
|
|
|
|
.fillMaxSize()
|
|
|
|
|
.background(colorBackground),
|
|
|
|
|
.background(MaterialTheme.colorScheme.background),
|
|
|
|
|
contentAlignment = Alignment.Center
|
|
|
|
|
) {
|
|
|
|
|
Column(modifier = Modifier
|
|
|
|
|
.padding(15.dp)
|
|
|
|
|
.drawBehind {
|
|
|
|
|
drawRoundRect(
|
|
|
|
|
gradienBox,
|
|
|
|
|
cornerRadius = CornerRadius(15.dp.toPx()),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
.background(
|
|
|
|
|
color = MaterialTheme.colorScheme.primary,
|
|
|
|
|
shape = RoundedCornerShape(15.dp)
|
|
|
|
|
)
|
|
|
|
|
) {
|
|
|
|
|
Row(modifier = Modifier.padding(15.dp)) {
|
|
|
|
|
ImageQuote(
|
|
|
|
@ -105,10 +107,7 @@ fun QuotePage(
|
|
|
|
|
Column {
|
|
|
|
|
|
|
|
|
|
FunctionalIcon(
|
|
|
|
|
// --/!\-- a modifier --/!\--
|
|
|
|
|
// isFavorite = service.isFavorite(id)
|
|
|
|
|
// --------------------------
|
|
|
|
|
false,
|
|
|
|
|
isFavorite = favorite,
|
|
|
|
|
userId = index,
|
|
|
|
|
id = quoteId,
|
|
|
|
|
context = context,
|
|
|
|
@ -154,7 +153,7 @@ fun QuotePage(
|
|
|
|
|
),
|
|
|
|
|
exit = slideOutVertically() + shrinkVertically() + fadeOut()
|
|
|
|
|
) {
|
|
|
|
|
Box(modifier = Modifier.fillMaxWidth().background(gradienBox).fillMaxSize()){
|
|
|
|
|
Box(modifier = Modifier.fillMaxWidth().background(MaterialTheme.colorScheme.primary).fillMaxSize()){
|
|
|
|
|
Column {
|
|
|
|
|
AddComment(index, service)
|
|
|
|
|
LstComment(service.getComment(quoteId))
|
|
|
|
@ -173,7 +172,7 @@ fun QuoteText(text: String ){
|
|
|
|
|
modifier = Modifier.padding(start = 10.dp, top = 15.dp),
|
|
|
|
|
fontWeight = FontWeight(1000),
|
|
|
|
|
fontSize = 20.sp,
|
|
|
|
|
color = iconText
|
|
|
|
|
color = MaterialTheme.colorScheme.onPrimary
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -214,7 +213,7 @@ fun FunctionalIcon(isFavorite: Boolean, userId : Int, id : Int, context : Contex
|
|
|
|
|
Icon(
|
|
|
|
|
Icons.Default.Share,
|
|
|
|
|
contentDescription = stringResource(R.string.share),
|
|
|
|
|
tint = iconText,
|
|
|
|
|
tint = MaterialTheme.colorScheme.onPrimary,
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
IconButton(
|
|
|
|
@ -226,7 +225,7 @@ fun FunctionalIcon(isFavorite: Boolean, userId : Int, id : Int, context : Contex
|
|
|
|
|
Icon(
|
|
|
|
|
Icons.Default.MailOutline,
|
|
|
|
|
contentDescription = stringResource(R.string.comment),
|
|
|
|
|
tint = iconText,
|
|
|
|
|
tint = MaterialTheme.colorScheme.onPrimary,
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -238,7 +237,7 @@ fun FunctionalIcon(isFavorite: Boolean, userId : Int, id : Int, context : Contex
|
|
|
|
|
Icon(
|
|
|
|
|
Icons.Default.Favorite,
|
|
|
|
|
contentDescription = stringResource(R.string.favorite),
|
|
|
|
|
tint = likeIcon,
|
|
|
|
|
tint = MaterialTheme.colorScheme.onPrimary,
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -251,7 +250,7 @@ fun FunctionalIcon(isFavorite: Boolean, userId : Int, id : Int, context : Contex
|
|
|
|
|
Icon(
|
|
|
|
|
Icons.Default.FavoriteBorder,
|
|
|
|
|
contentDescription = stringResource(R.string.favorite),
|
|
|
|
|
tint = iconText
|
|
|
|
|
tint = MaterialTheme.colorScheme.onPrimary
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -265,22 +264,20 @@ fun InfoQuoteText(nameId : Int, text : String){
|
|
|
|
|
text = stringResource(id = nameId),
|
|
|
|
|
fontSize = 18.sp,
|
|
|
|
|
fontWeight = FontWeight(500),
|
|
|
|
|
color = iconText
|
|
|
|
|
color = MaterialTheme.colorScheme.onPrimary
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
Text(
|
|
|
|
|
text = text,
|
|
|
|
|
color = whiteBackcgroundText,
|
|
|
|
|
color = MaterialTheme.colorScheme.onBackground,
|
|
|
|
|
fontSize = 16.sp,
|
|
|
|
|
fontWeight = FontWeight(400),
|
|
|
|
|
modifier = Modifier
|
|
|
|
|
.drawBehind {
|
|
|
|
|
drawRoundRect(
|
|
|
|
|
Color(255,255,255),
|
|
|
|
|
cornerRadius = CornerRadius(15.dp.toPx())
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
.padding(5.dp),
|
|
|
|
|
.background(
|
|
|
|
|
color = MaterialTheme.colorScheme.background,
|
|
|
|
|
shape = RoundedCornerShape(15.dp)
|
|
|
|
|
)
|
|
|
|
|
.padding(5.dp)
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -289,12 +286,12 @@ fun InfoQuoteText(nameId : Int, text : String){
|
|
|
|
|
fun LikeInfo(likes : Int){
|
|
|
|
|
Text(
|
|
|
|
|
text = likes.toString(),
|
|
|
|
|
color = iconText
|
|
|
|
|
color = MaterialTheme.colorScheme.onPrimary
|
|
|
|
|
)
|
|
|
|
|
Icon(
|
|
|
|
|
Icons.Default.Favorite,
|
|
|
|
|
contentDescription = stringResource(R.string.favorite),
|
|
|
|
|
tint = iconText,
|
|
|
|
|
tint = MaterialTheme.colorScheme.onPrimary,
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -308,19 +305,14 @@ fun AddComment(userId : Int, service: IServices){
|
|
|
|
|
Icon(
|
|
|
|
|
Icons.AutoMirrored.Filled.ArrowBack,
|
|
|
|
|
contentDescription = stringResource(R.string.send),
|
|
|
|
|
tint = iconText
|
|
|
|
|
tint = MaterialTheme.colorScheme.onPrimary
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
TextField(
|
|
|
|
|
value = text,
|
|
|
|
|
onValueChange = { text = it },
|
|
|
|
|
label = { Text(stringResource(R.string.comment)) },
|
|
|
|
|
modifier = Modifier.drawBehind {
|
|
|
|
|
drawRoundRect(
|
|
|
|
|
Color.White,
|
|
|
|
|
cornerRadius = CornerRadius(15.dp.toPx())
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
modifier = Modifier
|
|
|
|
|
.width(300.dp)
|
|
|
|
|
)
|
|
|
|
|
IconButton(
|
|
|
|
@ -329,7 +321,7 @@ fun AddComment(userId : Int, service: IServices){
|
|
|
|
|
Icon(
|
|
|
|
|
Icons.AutoMirrored.Filled.Send,
|
|
|
|
|
contentDescription = stringResource(R.string.send),
|
|
|
|
|
tint = iconText
|
|
|
|
|
tint = MaterialTheme.colorScheme.onPrimary
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -346,12 +338,10 @@ fun LstComment(lst : List<Comment>){
|
|
|
|
|
Column(
|
|
|
|
|
modifier = Modifier.padding(5.dp)
|
|
|
|
|
.fillMaxSize()
|
|
|
|
|
.drawBehind {
|
|
|
|
|
drawRoundRect(
|
|
|
|
|
Color.White,
|
|
|
|
|
cornerRadius = CornerRadius(15.dp.toPx())
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
.background(
|
|
|
|
|
color = MaterialTheme.colorScheme.onPrimary,
|
|
|
|
|
shape = RoundedCornerShape(15.dp)
|
|
|
|
|
)
|
|
|
|
|
) {
|
|
|
|
|
Row {
|
|
|
|
|
AsyncImage(
|
|
|
|
|