Created
June 26, 2021 04:34
-
-
Save sergenes/8cb4142d6144e8b80cd342cc65641a48 to your computer and use it in GitHub Desktop.
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 data = arrayListOf( | |
StudyCard(0, "1$LOREM_IPSUM_FRONT", "1$LOREM_IPSUM_BACK"), | |
StudyCard(1, "2$LOREM_IPSUM_FRONT", "2$LOREM_IPSUM_BACK"), | |
StudyCard(2, "3$LOREM_IPSUM_FRONT", "3$LOREM_IPSUM_BACK"), | |
StudyCard(3, "4$LOREM_IPSUM_FRONT", "4$LOREM_IPSUM_BACK"), | |
StudyCard(4, "5$LOREM_IPSUM_FRONT", "5$LOREM_IPSUM_BACK"), | |
StudyCard(5, "6$LOREM_IPSUM_FRONT", "6$LOREM_IPSUM_BACK") | |
) | |
@Preview | |
@Composable | |
fun TestStudyCardDeck() { | |
var current by remember { mutableStateOf(0) } | |
var visible by remember { mutableStateOf(3) } | |
Scaffold( | |
topBar = { | |
Column { | |
Row(Modifier.padding(16.dp)) { | |
NiceButton(title = "Next") { | |
if (current < data.lastIndex) | |
current += 1 | |
else | |
current = 0 | |
} | |
Spacer(Modifier.weight(1f)) | |
NiceButton(title = "Add") { | |
if (visible < data.lastIndex) | |
visible += 1 | |
else | |
visible = 1 | |
} | |
} | |
} | |
} | |
) { | |
StudyCardDeck(current, visible, data) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment