Cards
Cardsanimated

Trip Currency

Currency converter card with animated flip between source and target.

100 USD92 EUR

Installation

caveui components are copy-paste Jetpack Compose built entirely on Material 3 — there's no caveui dependency to add. Make sure Material 3 is on your classpath (it ships with the Compose BOM), then copy the Usage snippet below into your project.

kotlin
// build.gradle.kts (module)
dependencies {
    implementation(platform("androidx.compose:compose-bom:2025.06.00"))
    implementation("androidx.compose.material3:material3")
}

Usage

kotlin
@Composable
fun TripCurrencyCard() {
  var swapped by remember { mutableStateOf(false) }
  val rot by animateFloatAsState(
    if (swapped) 180f else 0f, label = "swap"
  )
  ElevatedCard(
    modifier = Modifier.fillMaxWidth().padding(16.dp)
      .clickable { swapped = !swapped }
  ) {
    Row(
      Modifier.padding(20.dp),
      verticalAlignment = Alignment.CenterVertically,
      horizontalArrangement = Arrangement.SpaceBetween
    ) {
      Text("100 USD", style = MaterialTheme.typography.titleMedium)
      Canvas(
        Modifier.size(24.dp).graphicsLayer { rotationZ = rot }
      ) {
        drawLine(
          Color(0xFF6366F1), Offset(0f, size.height / 2),
          Offset(size.width, size.height / 2), 3f
        )
      }
      Text("92 EUR", style = MaterialTheme.typography.titleMedium)
    }
  }
}