67 lines
2.0 KiB
Kotlin
67 lines
2.0 KiB
Kotlin
package dev.beefers.vendetta.manager.ui.widgets.about
|
|
|
|
import androidx.compose.foundation.clickable
|
|
import androidx.compose.foundation.layout.Arrangement
|
|
import androidx.compose.foundation.layout.Column
|
|
import androidx.compose.foundation.layout.Row
|
|
import androidx.compose.foundation.layout.fillMaxWidth
|
|
import androidx.compose.foundation.layout.padding
|
|
import androidx.compose.foundation.layout.size
|
|
import androidx.compose.foundation.shape.CircleShape
|
|
import androidx.compose.material3.LocalContentColor
|
|
import androidx.compose.material3.MaterialTheme
|
|
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.platform.LocalUriHandler
|
|
import androidx.compose.ui.unit.dp
|
|
import coil.compose.AsyncImage
|
|
|
|
@Composable
|
|
fun ListItem(
|
|
text: String,
|
|
subtext: String? = null,
|
|
imageUrl: String? = null,
|
|
onClick: (() -> Unit)? = null
|
|
) {
|
|
|
|
Row(
|
|
verticalAlignment = Alignment.CenterVertically,
|
|
horizontalArrangement = Arrangement.spacedBy(16.dp),
|
|
modifier = Modifier
|
|
.clickable(
|
|
enabled = onClick != null,
|
|
onClick = onClick ?: { -> }
|
|
)
|
|
.padding(16.dp)
|
|
.fillMaxWidth()
|
|
) {
|
|
imageUrl?.let {
|
|
AsyncImage(
|
|
model = it,
|
|
contentDescription = null,
|
|
modifier = Modifier
|
|
.size(35.dp)
|
|
.clip(CircleShape)
|
|
)
|
|
}
|
|
|
|
Column(
|
|
verticalArrangement = Arrangement.spacedBy(4.dp)
|
|
) {
|
|
Text(
|
|
text = text,
|
|
style = MaterialTheme.typography.bodyLarge
|
|
)
|
|
subtext?.let {
|
|
Text(
|
|
text = it,
|
|
style = MaterialTheme.typography.labelMedium,
|
|
color = LocalContentColor.current.copy(alpha = 0.5f)
|
|
)
|
|
}
|
|
}
|
|
}
|
|
} |