AnimatedContent

class AnimatedContent<T>(targetState: T, transitionSpec: AnimatedContentTransitionScope<T>.() -> Unit = { enter = fadeIn() exit = fadeOut() }, contentKey: (T) -> Any? = { it }, contentPosition: ContentPosition = ContentPosition.TopStart, style: Style = Style, label: String = "AnimatedContent", content: ComponentScope.(T) -> Component?) : KComponent

A container that animates between content for different targetState values. The target content enters while previously-keyed content exits; both are kept in the container's own subtree (an overlapping StackLayout) until each exit settles — the same container-owned retention model as AnimatedVisibility. No DisappearingHost / rendercore machinery is involved.

Content is keyed by contentKey; reusing the same key does not animate. The default transition is a cross-fade.

child(AnimatedContent(targetState = page) { p -> PageContent(p) })

Note: the default is visual-only (no layout-affecting size animation). SizeTransform is part of the API surface but the size-morph path is opt-in and not yet wired (pending perf validation); the container currently sizes to the target content.

Parameters

targetState

The state whose content should currently be shown.

transitionSpec

Declares the transition via AnimatedContentTransitionScope.enter / AnimatedContentTransitionScope.exit. Defaults to a cross-fade.

contentKey

Identity for a state's content; reusing a key does not animate.

contentPosition

Alignment of overlapping content.

style

Style applied to the container.

label

Debug label for the underlying transitions.

content

Builder for the content of a given state.

Constructors

Link copied to clipboard
constructor(targetState: T, transitionSpec: AnimatedContentTransitionScope<T>.() -> Unit = { enter = fadeIn() exit = fadeOut() }, contentKey: (T) -> Any? = { it }, contentPosition: ContentPosition = ContentPosition.TopStart, style: Style = Style, label: String = "AnimatedContent", content: ComponentScope.(T) -> Component?)

Functions

Link copied to clipboard
Link copied to clipboard
operator override fun equals(@Nullable other: Any?): Boolean
Link copied to clipboard
Link copied to clipboard
open fun <T : Any> getDebugAttribute(attributeKey: AttributeKey<T>): @Nullable T?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

This indicates the type of the Object that will be returned by mount.

Link copied to clipboard
override fun getSimpleName(): String
Link copied to clipboard
fun getTypeId(): Int
Link copied to clipboard
override fun hashCode(): Int
Link copied to clipboard
override fun isEquivalentTo(other: Component?): Boolean

Compares this component to a different one to check if they are the same

Link copied to clipboard
override fun makeShallowCopy(): Component
Link copied to clipboard
fun measure(c: ComponentContext, widthSpec: Int, heightSpec: Int, outputSize: Size)
fun measure(c: ComponentContext, widthSpec: Int, heightSpec: Int, outputSize: Size, shouldCacheResult: Boolean)

Measure a component with the given SizeSpec constraint.

Link copied to clipboard
fun measureMightNotCacheInternalNode(c: ComponentContext, widthSpec: Int, heightSpec: Int, outputSize: Size)

Should not be used! Components should be manually measured only as part of a LayoutState calculation. This will measure a component and set the size in the outputSize object but the measurement result will not be cached and reused for future measurements of this component.

Link copied to clipboard
open override fun ComponentScope.render(): Component
Link copied to clipboard
open override fun resolveDeferred(calculationContext: CalculationContext, componentContext: ComponentContext, parentContext: ComponentContext): ComponentResolveResult

Returns the component's resolve result for a deferred resolution. The framework invokes this instead of the resolve if the component needs to defer its resolution until layout.

Link copied to clipboard
fun Component.resolveDeferred(calculationContext: CalculationContext, componentContext: ComponentContext, parentContext: ComponentContext, commonProps: CommonProps?): ComponentResolveResult
Link copied to clipboard
Link copied to clipboard
open override fun <T : Any> setDebugAttributeKey(attributeKey: AttributeKey<T>, value: T & Any)
Link copied to clipboard
override fun toString(): String