~repos /only-bible-app
git clone
https://pyrossh.dev/repos/only-bible-app.git
The only bible app you will ever need. No ads. No in-app purchases. No distractions.
file:
composeApp/src/commonMain/kotlin/dev/pyrossh/onlyBible/composables/BibleSelector.kt
package dev.pyrossh.onlyBible.composables
import androidx.compose.foundation.clickableimport androidx.compose.foundation.layout.fillMaxWidthimport androidx.compose.foundation.layout.heightimport androidx.compose.foundation.layout.paddingimport androidx.compose.foundation.lazy.LazyColumnimport androidx.compose.foundation.lazy.itemsimport androidx.compose.foundation.lazy.rememberLazyListStateimport androidx.compose.foundation.shape.RoundedCornerShapeimport androidx.compose.material3.Cardimport androidx.compose.material3.ListItemimport androidx.compose.material3.Textimport androidx.compose.runtime.Composableimport androidx.compose.ui.Modifierimport androidx.compose.ui.text.font.FontWeightimport androidx.compose.ui.unit.dpimport androidx.compose.ui.window.Dialogimport dev.pyrossh.onlyBible.domain.Bibleimport dev.pyrossh.onlyBible.domain.biblesimport dev.pyrossh.onlyBible.getScreenHeight
@Composablefun BibleSelector( bible: Bible, onSelected: (Bible) -> Unit, onClose: () -> Unit,) { val height = getScreenHeight() / 2 val bibleIndex = bibles.indexOf(bible) val scrollState = rememberLazyListState( initialFirstVisibleItemIndex = if (bibleIndex - 2 >= 0) bibleIndex - 2 else 0, ) Dialog(onDismissRequest = { onClose() }) { Card( modifier = Modifier .fillMaxWidth() .height(height), shape = RoundedCornerShape(8.dp), ) { LazyColumn( state = scrollState ) { items(bibles) { ListItem( modifier = Modifier.clickable { onSelected(it) }, headlineContent = { Text( modifier = Modifier.padding(start = 4.dp), fontWeight = FontWeight.W600, text = it.languageEnglish ) }, supportingContent = { Text( modifier = Modifier.padding(start = 4.dp), text = it.languageNative ) } ) } } } }}