AnimatedNavDecoration

class AnimatedNavDecoration(animatedScreenTransforms: ImmutableMap<KClass<out Screen>, AnimatedScreenTransform>, decoratorFactory: AnimatedNavDecorator.Factory) : NavDecoration(source)

AnimatedNavDecoration is an implementation of NavDecoration that provides the Navigation AnimatedVisibilityScope for shared elements. It also allows for indepth customization of its AnimatedContent through a AnimatedNavDecorator. AnimatedNavDecoration is the default NavDecoration used by Circuit.

How this works:

Examples

Using this AnimatedNavDecorator.Factory for the CustomDecorator in the AnimatedNavDecorator example.

class CustomAnimatedNavDecoratorFactory() : AnimatedNavDecorator.Factory {
override fun <T : NavArgument> create(): AnimatedNavDecorator<T, *> {
return CustomDecorator()
}
}

You can customize the default AnimatedNavDecoration when building a Circuit instance by providing the CustomAnimatedNavDecoratorFactory to the Circuit.Builder. You can also add an AnimatedScreenTransform for a specific Screen.

Circuit.Builder()
.addUiFactories()
.addPresenterFactories()
.addAnimatedScreenTransform(CustomScreen::class, CustomScreenAnimatedTransform)
.setAnimatedNavDecoratorFactory(CustomAnimatedNavDecoratorFactory())
.build()

You can also customize the AnimatedNavDecoration for a specific NavigableCircuitContent by providing it with an AnimatedNavDecorator.Factory. The provided AnimatedNavDecorator.Factory will override any existing NavDecoration for that NavigableCircuitContent.

NavigableCircuitContent(
navigator = navigator,
backStack = backStack,
decoratorFactory = remember { CustomAnimatedNavDecoratorFactory() },
)

Parameters

animatedScreenTransforms

A Map of AnimatedScreenTransform that might be used to override the default ContentTransform provided by the AnimatedNavDecorator.

decoratorFactory

A factory used to create a AnimatedNavDecorator instance.

See also

Constructors

Link copied to clipboard
constructor(animatedScreenTransforms: ImmutableMap<KClass<out Screen>, AnimatedScreenTransform>, decoratorFactory: AnimatedNavDecorator.Factory)

Functions

Link copied to clipboard
open override fun <T : NavArgument> DecoratedContent(args: ImmutableList<T>, backStackDepth: Int, modifier: Modifier, content: @Composable (T) -> Unit)