diff --git a/app/src/main/java/app/myzel394/locationtest/ui/components/SettingsTile.kt b/app/src/main/java/app/myzel394/locationtest/ui/components/SettingsTile.kt new file mode 100644 index 0000000..c312081 --- /dev/null +++ b/app/src/main/java/app/myzel394/locationtest/ui/components/SettingsTile.kt @@ -0,0 +1,72 @@ +package app.myzel394.locationtest.ui.components + +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.width +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.Mic +import androidx.compose.material3.ButtonDefaults +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Icon +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.unit.dp +import com.maxkeppeker.sheets.core.models.base.rememberUseCaseState +import com.maxkeppeler.sheets.duration.DurationDialog +import com.maxkeppeler.sheets.duration.models.DurationConfig +import com.maxkeppeler.sheets.duration.models.DurationFormat +import com.maxkeppeler.sheets.duration.models.DurationSelection +import kotlinx.serialization.json.JsonNull.content + + +@Composable +fun SettingsTile( + title: String, + description: String, + leading: @Composable () -> Unit = {}, + trailing: @Composable () -> Unit = {}, + extra: (@Composable () -> Unit)? = null, +) { + val content = @Composable { + Row( + verticalAlignment = Alignment.CenterVertically, + modifier = Modifier + .fillMaxWidth() + .padding(16.dp) + ) { + leading() + Spacer(modifier = Modifier.width(16.dp)) + Column( + modifier = Modifier.weight(1f) + ) { + Text( + text = title, + style = MaterialTheme.typography.labelLarge, + ) + Spacer(modifier = Modifier.height(4.dp)) + Text( + text = description, + style = MaterialTheme.typography.bodySmall, + ) + } + Spacer(modifier = Modifier.width(16.dp)) + trailing() + } + } + + if (extra != null) { + Column { + content() + extra() + } + } else { + content() + } +} \ No newline at end of file