Skip to content

Instantly share code, notes, and snippets.

@mukeshsolanki
Created July 17, 2022 11:36
Show Gist options
  • Save mukeshsolanki/1035dc9dc49ba3297d048466cc247891 to your computer and use it in GitHub Desktop.
Save mukeshsolanki/1035dc9dc49ba3297d048466cc247891 to your computer and use it in GitHub Desktop.
@Composable
fun SplashScreen(navController: NavHostController) {
Box(
modifier = Modifier
.fillMaxSize()
.background(MaterialTheme.colors.primary)
) {
val composition by rememberLottieComposition(LottieCompositionSpec.RawRes(R.raw.logo))
val logoAnimationState =
animateLottieCompositionAsState(composition = composition)
LottieAnimation(
composition = composition,
progress = { logoAnimationState.progress }
)
if (logoAnimationState.isAtEnd && logoAnimationState.isPlaying) {
navController.navigate(Screen.Home.route)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment