This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class StudyCard( | |
val index: Int, | |
val frontVal: String, | |
val backVal: String, | |
val frontLang: String = "English", | |
val backLang: String = "English" | |
) | |
private val colors = arrayOf(primaryColor, secondaryColor, tertiaryColor) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val cardWidth = 350.dp | |
val cardHeight = 380.dp | |
const val paddingOffset = 32f | |
const val LOREM_IPSUM_FRONT = "Lorem ipsum dolor sit amet, consectetur adipiscing elit." | |
const val LOREM_IPSUM_BACK = | |
"Integer dolor nisl, finibus eget dignissim sit amet, semper vel ipsum." | |
@Preview | |
@Composable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun StudyCardsBottomBar( | |
index: Int, | |
count: Int, | |
side: CardFlipState = CardFlipState.FRONT_FACE, | |
frontSideColor: Color, | |
leftActionHandler: (CardFlipState) -> Unit = {}, | |
rightActionHandler: () -> Unit = {} | |
) { | |
Row( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun StudyCardsContent(data: String, backgroundColor: Color) { | |
Column( | |
modifier = Modifier | |
.fillMaxHeight() | |
.fillMaxWidth() | |
.background(backgroundColor), | |
verticalArrangement = Arrangement.Center, | |
horizontalAlignment = Alignment.CenterHorizontally | |
) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val color = if (side == CardFlipState.FRONT_FACE) backgroundColor | |
else backSideColor | |
Surface( | |
modifier = modifier, | |
shape = RoundedCornerShape(cornerRadiusBig), | |
color = color, | |
elevation = normalElevation, | |
content = { | |
Scaffold( | |
modifier = Modifier.fillMaxSize(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum class CardFlipState { | |
FRONT_FACE, BACK_FACE | |
} | |
val cornerRadiusBig = 20.dp | |
val normalElevation = 1.dp | |
val backSideColor = Color(0xFFfef49c) | |
val secondaryColor = Color(0xffb2ffa1) | |
val tertiaryColor = Color(0xFFb6caff) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
compose_version = "1.0.0-beta08" | |
kotlin_version = "1.5.10" | |
// Material icons: | |
implementation "androidx.compose.material:material-icons-extended:$compose_version" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class ListFile(var fileName: String, var created: String) | |
@Preview | |
@Composable | |
fun ListTest() { | |
var editMode by remember { mutableStateOf(false) } | |
val data = remember { | |
mutableStateListOf<ListFile>( | |
ListFile("Test 1", "11/06/2021"), | |
ListFile("Test 2", "11/07/2021"), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun HomeListLazy( | |
editMode: Boolean, | |
itemsSource: SnapshotStateList<ListFile>, | |
clickItemHandler: (Int) -> Unit, | |
deleteItemHandler: (Int) -> Unit | |
) { | |
LazyColumn { | |
when (itemsSource.size) { | |
1 -> itemsSource.first().let { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun HomeList( | |
editMode: Boolean, | |
items: SnapshotStateList<ListFile>, | |
clickItemHandler: (Int) -> Unit, | |
deleteItemHandler: (Int) -> Unit | |
) { | |
Column { | |
when (items.size) { | |
1 -> items.first().let { |