64 lines
2.0 KiB
Kotlin
64 lines
2.0 KiB
Kotlin
package dev.beefers.vendetta.manager.ui.components.settings
|
|
|
|
import androidx.compose.foundation.layout.Arrangement
|
|
import androidx.compose.foundation.layout.Box
|
|
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.heightIn
|
|
import androidx.compose.foundation.layout.padding
|
|
import androidx.compose.material3.MaterialTheme
|
|
import androidx.compose.material3.ProvideTextStyle
|
|
import androidx.compose.runtime.Composable
|
|
import androidx.compose.ui.Alignment
|
|
import androidx.compose.ui.Modifier
|
|
import androidx.compose.ui.text.font.FontWeight
|
|
import androidx.compose.ui.unit.dp
|
|
import androidx.compose.ui.unit.sp
|
|
|
|
@Composable
|
|
fun SettingsItem(
|
|
modifier: Modifier = Modifier,
|
|
icon: @Composable (() -> Unit)? = null,
|
|
text: @Composable () -> Unit,
|
|
secondaryText: @Composable (() -> Unit) = { },
|
|
trailing: @Composable (() -> Unit) = { },
|
|
) {
|
|
Row(
|
|
modifier = modifier
|
|
.heightIn(min = 64.dp)
|
|
.fillMaxWidth()
|
|
.padding(horizontal = 18.dp, vertical = 14.dp),
|
|
horizontalArrangement = Arrangement.spacedBy(14.dp),
|
|
verticalAlignment = Alignment.CenterVertically
|
|
) {
|
|
if (icon != null) Box(modifier = Modifier.padding(8.dp)) {
|
|
icon()
|
|
}
|
|
|
|
Column(
|
|
verticalArrangement = Arrangement.spacedBy(5.dp)
|
|
) {
|
|
ProvideTextStyle(
|
|
MaterialTheme.typography.titleLarge.copy(
|
|
fontWeight = FontWeight.Normal,
|
|
fontSize = 19.sp
|
|
)
|
|
) {
|
|
text()
|
|
}
|
|
ProvideTextStyle(
|
|
MaterialTheme.typography.bodyMedium.copy(
|
|
color = MaterialTheme.colorScheme.onSurface.copy(0.6f)
|
|
)
|
|
) {
|
|
secondaryText()
|
|
}
|
|
}
|
|
|
|
Spacer(Modifier.weight(1f, true))
|
|
|
|
trailing()
|
|
}
|
|
} |