AnimatedSlot<T> class

============================================================================ ADVANCED SLOT WIDGETS

AnimatedSlot - Automatically animates between value changes.

Wraps value changes with an implicit animation, providing smooth transitions when the signal emits new values.

Example:

class MyController extends NeuronController {
  late final counter = Signal<int>(0).bind(this);
}

// Basic usage:
AnimatedSlot<int>(
  connect: controller.counter,
  duration: Duration(milliseconds: 300),
  curve: Curves.easeInOut,
  to: (ctx, val) => Text('$val'),
)

// With effects:
AnimatedSlot<int>(
  connect: controller.counter,
  effect: SlotEffect.fadeScale | SlotEffect.blur,
  to: (ctx, val) => Text('$val'),
)

// Direction-aware animation:
AnimatedSlot<int>(
  connect: controller.counter,
  directionalEffect: DirectionalEffect.vertical,
  to: (ctx, val) => Text('$val'),
)
Inheritance
Available extensions

Constructors

AnimatedSlot({Key? key, required Signal<T> connect, required Widget to(BuildContext context, T value), Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeInOut, Curve? exitCurve, SlotEffect effect = SlotEffect.fade, DirectionalEffect? directionalEffect, Duration delay = Duration.zero, VoidCallback? onAnimationStart, VoidCallback? onAnimationComplete, Widget? child, double scaleBegin = 0.8, double scaleEnd = 1.0, Offset slideOffset = const Offset(0, 0.3), double rotationTurns = 0.25, double blurSigma = 5.0, bool clipBehavior = false})
Creates an AnimatedSlot that smoothly animates between value changes.
const

Properties

blurSigma double
Blur intensity for blur effect. Default: 5.0.
final
child Widget?
Optional child widget passed to the builder.
final
clipBehavior bool
Whether to clip content during animation to prevent overflow.
final
connect Signal<T>
The signal to connect to. The slot rebuilds when this signal emits.
final
curve Curve
Curve applied to the animation. Default: Curves.easeInOut.
final
delay Duration
Delay before the animation starts. Default: Duration.zero.
final
directionalEffect DirectionalEffect?
Direction-aware effect that changes based on value direction.
final
duration Duration
Duration of the animation. Default: 300ms.
final
effect SlotEffect
Visual effect applied during transitions. Default: SlotEffect.fade.
final
exitCurve Curve?
Curve for the exiting widget. If null, uses curve.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onAnimationComplete VoidCallback?
Called when the animation completes.
final
onAnimationStart VoidCallback?
Called when the animation starts.
final
rotationTurns double
Number of turns for rotation effect. Default: 0.25 (90 degrees).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scaleBegin double
Starting scale for scale effects. Default: 0.8.
final
scaleEnd double
Ending scale for scale effects. Default: 1.0.
final
slideOffset Offset
Offset for slide effects in relative units. Default: (0, 0.3).
final
to Widget Function(BuildContext context, T value)
Builder function that creates the widget for the current value.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<AnimatedSlot<T>>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onTap(VoidCallback onTap, {double pressedScale = 0.95}) Widget

Available on Widget, provided by the SlotWidgetModifiers extension

Wrap with tap gesture.
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited
withDelay(Duration delay) Widget

Available on Widget, provided by the SlotWidgetModifiers extension

Add a delay before showing.
withFade({Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeInOut}) Widget

Available on Widget, provided by the SlotWidgetModifiers extension

Wrap with fade animation on appear.
withHero(Object tag) Widget

Available on Widget, provided by the SlotWidgetModifiers extension

Wrap with hero animation.
withScale({double begin = 0.8, double end = 1.0, Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeOutBack}) Widget

Available on Widget, provided by the SlotWidgetModifiers extension

Wrap with scale animation on appear.
withShimmer({Duration duration = const Duration(milliseconds: 1500), Color baseColor = const Color(0xFFE0E0E0), Color highlightColor = const Color(0xFFF5F5F5)}) Widget

Available on Widget, provided by the SlotWidgetModifiers extension

Apply a shimmer loading effect.
withSlide({Offset begin = const Offset(0, 0.2), Offset end = Offset.zero, Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeOutCubic}) Widget

Available on Widget, provided by the SlotWidgetModifiers extension

Wrap with slide animation on appear.

Operators

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