UiContourCrossfadeController<T> class

A reusable, generic cross-dissolve abstraction: when update receives a value whose identity differs from the current one, the old value fades out while the new value fades in over one shared progress timeline — both visible simultaneously mid-transition, neither morphing into the other's geometry or position. See doc/contour.md, "Two kinds of value change."

Use this when consecutive values occupy the same on-screen slot but are structurally unrelated (a different tab's accessory content, a different screen's toolbar actions) — there is nothing to geometrically morph between them, only a soft dissolve. For a slot whose existence changes (appears/disappears entirely), use UiContourPresenceController instead; the two compose when a persistent shell's existence is owned by UiContourPresenceController while its inner content, once visible, is owned by this controller.

identity defaults to next itself (via ==) when omitted, which suits plain value types. Widget-bearing types such as configuration records rarely override == in a way that's meaningful here — a fresh instance is typically rebuilt every frame even when nothing logically changed — so callers holding those should pass an explicit, stable identity (e.g. a label or index), the same pattern AnimatedSwitcher uses with child.key.

Inheritance

Constructors

UiContourCrossfadeController({required TickerProvider vsync})

Properties

current → T?
The value fading in, or already fully visible at rest.
no setter
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
isDisposed bool
no setter
isTransitioning bool
Whether a transition is in flight — previous is non-null and still fading out.
no setter
previous → T?
The value fading out, or null once the transition settles.
no setter
progress double
0 at the start of a transition (only previous visible), 1 at rest (only current visible).
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
dispose() → void
Discards any resources used by the object.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
toString() String
A string representation of this object.
inherited
update(BuildContext context, T? next, {Object? identity, UiMotionDuration? duration}) → void
Sets the target value. Starts a new cross-dissolve from whatever is currently visible only when identity (or next itself, if identity is omitted) differs from the current identity — interrupting an in-flight transition restarts cleanly from the visually-current blend rather than discarding it.

Operators

operator ==(Object other) bool
The equality operator.
inherited