Skip to content

Instantly share code, notes, and snippets.

@sergenes
Created June 26, 2021 03:39
Show Gist options
  • Save sergenes/fa47e58b73e0c94ec7bab36bcbedadc2 to your computer and use it in GitHub Desktop.
Save sergenes/fa47e58b73e0c94ec7bab36bcbedadc2 to your computer and use it in GitHub Desktop.
@Composable
fun StudyCardsBottomBar(
index: Int,
count: Int,
side: CardFlipState = CardFlipState.FRONT_FACE,
frontSideColor: Color,
leftActionHandler: (CardFlipState) -> Unit = {},
rightActionHandler: () -> Unit = {}
) {
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceEvenly,
modifier = Modifier.padding(smallSpace)
) {
val buttonColor = if (side == CardFlipState.FRONT_FACE) backSideColor else frontSideColor
val leftTitle = if (side == CardFlipState.FRONT_FACE) "Peep" else "Back"
val rightTitle = "Say"
NiceButton(
title = leftTitle,
backgroundColor = buttonColor,
onClick = { leftActionHandler.invoke(side) }
)
Spacer(Modifier.weight(1f))
Text("${index + 1} of $count")
Spacer(Modifier.weight(1f))
NiceButton(
title = rightTitle,
backgroundColor = buttonColor,
onClick = { rightActionHandler.invoke() }
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment