65 lines
2.1 KiB
Kotlin
65 lines
2.1 KiB
Kotlin
package com.radiola.ui.components
|
|
|
|
import androidx.compose.foundation.background
|
|
import androidx.compose.foundation.clickable
|
|
import androidx.compose.foundation.layout.*
|
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
import androidx.compose.material3.Card
|
|
import androidx.compose.material3.CardDefaults
|
|
import androidx.compose.material3.MaterialTheme
|
|
import androidx.compose.material3.Text
|
|
import androidx.compose.runtime.Composable
|
|
import androidx.compose.ui.Modifier
|
|
import androidx.compose.ui.draw.clip
|
|
import androidx.compose.ui.graphics.Brush
|
|
import androidx.compose.ui.graphics.Color
|
|
import androidx.compose.ui.layout.ContentScale
|
|
import androidx.compose.ui.unit.dp
|
|
import coil.compose.AsyncImage
|
|
import com.radiola.domain.model.Station
|
|
|
|
@Composable
|
|
fun StationCard(
|
|
station: Station,
|
|
onClick: () -> Unit,
|
|
modifier: Modifier = Modifier
|
|
) {
|
|
Card(
|
|
modifier = modifier
|
|
.aspectRatio(1f)
|
|
.clickable(onClick = onClick),
|
|
shape = RoundedCornerShape(12.dp),
|
|
colors = CardDefaults.cardColors(containerColor = Color(0xFF1E1E1E))
|
|
) {
|
|
Column {
|
|
Box(
|
|
modifier = Modifier
|
|
.fillMaxWidth()
|
|
.weight(1f)
|
|
.clip(RoundedCornerShape(topStart = 12.dp, topEnd = 12.dp))
|
|
.background(
|
|
Brush.linearGradient(
|
|
colors = listOf(
|
|
Color(0xFF667eea),
|
|
Color(0xFF764ba2)
|
|
)
|
|
)
|
|
)
|
|
) {
|
|
AsyncImage(
|
|
model = station.coverUrl,
|
|
contentDescription = station.name,
|
|
modifier = Modifier.fillMaxSize(),
|
|
contentScale = ContentScale.Crop
|
|
)
|
|
}
|
|
Text(
|
|
text = station.name,
|
|
style = MaterialTheme.typography.bodyMedium,
|
|
modifier = Modifier.padding(12.dp),
|
|
maxLines = 1
|
|
)
|
|
}
|
|
}
|
|
}
|