Kotlin transition-animation

Open-source Kotlin projects categorized as transition-animation

Top 4 Kotlin transition-animation Projects

  • voyager

    🛸 A pragmatic navigation library for Jetpack Compose (by adrielcafe)

  • Project mention: Building a subscription tracker Desktop and iOS app with compose multiplatform | dev.to | 2024-05-27

    // composeApp/src/commonMain/kotlin/ui/screens/expenses/ExpensesScreenViewModel.kt package ui.screens.expenses import Expense import cafe.adriel.voyager.core.model.StateScreenModel import cafe.adriel.voyager.core.model.screenModelScope import io.github.oshai.kotlinlogging.KotlinLogging import kotlinx.coroutines.delay import kotlinx.coroutines.launch private val logger = KotlinLogging.logger {} /** * Base state definition for our screen */ data class ExpensesScreenState( val data: List, ) { /** * Computed property to get the avg price of the expenses */ val avgExpenses: String get() = data.map { it.price }.average().toString() } /** * View model of our screen * More about ViewModels below */ class ExpensesScreenViewModel : StateScreenModel( ExpensesScreenState( data = listOf(), ), ) { init { /** * Simulating the "API request" by adding some latency * and fake data */ screenModelScope.launch { logger.info { "Fetching expenses" } delay(3000) mutableState.value = ExpensesScreenState( data = listOf( Expense( id = "1", name = "Rent", icon = "🏠", price = 102573, ), Expense( id = "2", name = "Apple one", icon = "🍎", price = 2595, ), Expense( id = "3", name = "Netflix", icon = "📺", price = 1299, ), ) ) } } } // composeApp/src/commonMain/kotlin/ui/screens/expenses/ExpensesScreen.kt package ui.screens.expenses import Expense import androidx.compose.foundation.layout.* import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.* import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import cafe.adriel.voyager.core.model.rememberScreenModel import cafe.adriel.voyager.core.screen.Screen import io.github.oshai.kotlinlogging.KotlinLogging import ui.theme.BorderRadius import ui.theme.IconSize import ui.theme.Spacing private val logger = KotlinLogging.logger {} /** * Voyager screen, since there are no params * we can define it as a plain `object` */ object ExpensesScreen : Screen { @Composable override fun Content() { /** * Instantiating our ViewModel * https://voyager.adriel.cafe/screenmodel */ val viewModel = rememberScreenModel { ExpensesScreenViewModel() } /** * More about this below, but for now, differently than JS * we handle values over time with Kotlin coroutine `Flow's` (in this case, `StateFlow`) * you can think of it as something similar to `Observables` in reactive programming */ val state by viewModel.state.collectAsState() val onExpenseClicked: (Expense) -> Unit = { logger.info { "Redirect to edit screen" } } Scaffold( topBar = { CenterAlignedTopAppBar( title = { Text("My subscriptions", style = MaterialTheme.typography.titleMedium) }, ) }, bottomBar = { BottomAppBar( contentPadding = PaddingValues(horizontal = Spacing.Large), ) { Row( modifier = Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.SpaceBetween, ) { Column { Text( "Average expenses", style = MaterialTheme.typography.bodyLarge, ) Text( "Per month".uppercase(), style = MaterialTheme.typography.bodyMedium, ) } Text( state.avgExpenses, style = MaterialTheme.typography.labelLarge, ) } } }, ) { paddingValues -> Box(modifier = Modifier.padding(paddingValues)) { ExpenseList(state.data, onExpenseClicked) } } } } @Composable private fun ExpenseList( expenses: List, onClick: (expense: Expense) -> Unit, ) { LazyColumn( verticalArrangement = Arrangement.spacedBy(Spacing.Small_100), ) { items( items = expenses, key = { it.id }, ) { expense -> ExpenseListItem( expense = expense, onClick = { logger.info { "Clicked on ${expense.name}" } onClick(expense) }, ) } item { Spacer(Modifier.height(Spacing.Medium)) } } } @Composable private fun ExpenseListItem( expense: Expense, onClick: () -> Unit = {}, ) { Surface( modifier = Modifier .fillMaxWidth() .padding(horizontal = Spacing.Medium) .defaultMinSize(minHeight = 56.dp), onClick = onClick, shape = RoundedCornerShape(BorderRadius.small), color = MaterialTheme.colorScheme.surfaceVariant, ) { Row( modifier = Modifier .padding( horizontal = Spacing.Medium_100, vertical = Spacing.Small_100, ), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(Spacing.Large), ) { Text( text = expense.icon ?: "", fontSize = IconSize.Medium, modifier = Modifier.defaultMinSize(minWidth = 24.dp), ) Text( text = expense.name, style = MaterialTheme.typography.bodyLarge.copy(color = MaterialTheme.colorScheme.onSurfaceVariant), modifier = Modifier.weight(1f), ) Text( text = (expense.price).toString(), style = MaterialTheme.typography.bodyLarge.copy(color = MaterialTheme.colorScheme.onSurfaceVariant), ) } } }

  • Appyx

    Model-driven navigation + UI components with gesture control for Compose Multiplatform

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • compose-shared-element

    Experiment with SharedElement transition in Jetpack Compose, inspired by Flutter Hero widget.

  • guia

    Navigation Component for Jetpack Compose with support for screens, dialogs, bottomsheets, transitions and multi module projects

NOTE: The open source projects on this list are ordered by number of github stars. The number of mentions indicates repo mentiontions in the last 12 Months or since we started tracking (Dec 2020).

Kotlin transition-animation related posts

  • 4 reasons Jetpack Compose is better than XML

    4 projects | /r/androiddev | 7 May 2022
  • voyager VS compose-navigation-reimagined - a user suggested alternative

    2 projects | 4 Feb 2022
  • When you heard everything is easier with Compose and then spend 3 hours trying to figure out why your padding doesn't show up

    1 project | /r/mAndroidDev | 1 Sep 2021
  • Margin is deprecated

    1 project | /r/mAndroidDev | 20 Mar 2021

Index

What are some of the best open-source transition-animation projects in Kotlin? This list will help you:

Project Stars
1 voyager 2,282
2 Appyx 1,080
3 compose-shared-element 385
4 guia 171

Sponsored
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com