In settings.gradle.kts add jitpack repository :
repositories {
google()
mavenCentral()
maven { url = uri("https://jitpack.io" ) } // This line
}
Then you can add dependency :
implementation("com.github.ThomasBernard03:Composents:version")
fun PrimaryButton(
text : String,
modifier: Modifier = Modifier,
enabled: Boolean = true,
loading : Boolean = false,
onClick: () -> Unit
)
@Composable
fun OutlinedButton(
text: String,
modifier : Modifier = Modifier,
enabled : Boolean = true,
loading : Boolean = false,
color : Color = MaterialTheme.colorScheme.primary,
onClick: () -> Unit
)
@Composable
fun SquaredButton(
modifier : Modifier = Modifier,
@DrawableRes resource: Int,
onClick: () -> Unit,
backgroundColor : Color = MaterialTheme.colorScheme.primary,
color : Color = Color.White,
)
Slow motion demonstration :
animatedComposable is an extension method of NavGraphBuilder. To use it, simply replace the "composables" in your NavHost with animatedComposables. It can be used like this :
NavHost(navController = navController, startDestination = "home"){
animatedComposable("home"){
HomeScreen()
}
animatedComposable("buttons"){
ButtonsScreen()
}
}