parent
c35948e2e6
commit
38038c7939
@ -1,59 +1,87 @@
|
||||
package com.example.what_the_fantasy.ui.components
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
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.Modifier
|
||||
import androidx.compose.ui.draw.drawBehind
|
||||
import androidx.compose.ui.geometry.CornerRadius
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import coil.compose.rememberAsyncImagePainter
|
||||
import coil.compose.rememberImagePainter
|
||||
import com.example.what_the_fantasy.data.model.Quote
|
||||
import com.example.what_the_fantasy.ui.theme.colorBackground
|
||||
import com.example.what_the_fantasy.ui.theme.gradienBox
|
||||
|
||||
@Composable
|
||||
fun QuoteLittle(quote: Quote, modifier: Modifier) {
|
||||
Column(modifier = modifier.padding(10.dp).drawBehind {
|
||||
drawRoundRect(
|
||||
Color(70,190,115),
|
||||
cornerRadius = CornerRadius(10.dp.toPx())
|
||||
)
|
||||
}.size(500.dp, 600.dp))
|
||||
{
|
||||
Text(
|
||||
text = '"'+quote.content+'"'
|
||||
|
||||
fun QuoteLittle(quote: Quote, modifier: Modifier = Modifier) {
|
||||
Row(
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.padding(8.dp)
|
||||
.clip(RoundedCornerShape(16.dp))
|
||||
.background(colorBackground)
|
||||
) {
|
||||
Image(
|
||||
painter = rememberAsyncImagePainter(quote.imgUrl),
|
||||
contentDescription = "Character Image",
|
||||
contentScale = ContentScale.Crop,
|
||||
modifier = Modifier
|
||||
.size(width = 135.dp, height = 135.dp)
|
||||
.clip(
|
||||
RoundedCornerShape(
|
||||
topStart = 12.dp,
|
||||
bottomStart = 12.dp,
|
||||
topEnd = 0.dp,
|
||||
bottomEnd = 0.dp
|
||||
)
|
||||
InfoQuoteText(
|
||||
name = "@string/source",
|
||||
text = quote.source
|
||||
)
|
||||
InfoQuoteText(
|
||||
name = "@string/charac",
|
||||
text = quote.character
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun InfoQuoteText(name : String, text : String){
|
||||
Column{
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.height(135.dp)
|
||||
.clip(
|
||||
RoundedCornerShape(
|
||||
topEnd = 12.dp,
|
||||
bottomEnd = 12.dp
|
||||
)
|
||||
)
|
||||
.background(gradienBox)
|
||||
.padding(12.dp)
|
||||
) {
|
||||
Text(
|
||||
text = name
|
||||
text = quote.content,
|
||||
color = Color.White,
|
||||
fontSize = 16.sp,
|
||||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
|
||||
Text(
|
||||
text = text,
|
||||
modifier = Modifier
|
||||
.drawBehind {
|
||||
drawRoundRect(
|
||||
Color(255,255,255),
|
||||
cornerRadius = CornerRadius(15.dp.toPx())
|
||||
text = "Film : ${quote.source}",
|
||||
color = Color.White,
|
||||
fontSize = 12.sp
|
||||
)
|
||||
}
|
||||
.padding(5.dp)
|
||||
Text(
|
||||
text = "Personnage : ${quote.character}",
|
||||
color = Color.White,
|
||||
fontSize = 12.sp
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in new issue