SizedBoxAct class

Animates widget size using width and/or height constraints.

SizedBoxAct animates the size of a widget by specifying target dimensions. You can animate width only, height only, or both simultaneously.

Use .sizedBox() factory to create instances. This is the recommended approach for most size animations.

Infinite Dimension Support

SizedBoxAct supports animating to double.infinity because all values are normalized before animation occurs. The normalization process converts infinite values to the maximum available constraint dimensions at animation time, enabling smooth transitions from finite sizes to fill-available-space behavior.

Like SizedBox, when using double.infinity, the widget must be inside a bounded constraint. If the constraint is unbounded, an assertion error will be thrown.

// Animate from fixed width to filling available space
Actor(
  acts: [
    .sizedBox(width: .tween(100, double.infinity)),
  ],
  child: MyWidget(),
)

Basic Size Animation

// Animate just the width
Actor(
  acts: [
    .sizedBox(width: .tween(100, 300)),
  ],
  child: MyWidget(),
)

Dual Axis Animation

// Animate both width and height
Actor(
  acts: [
    .sizedBox(
      width: .tween(100, 200),
      height: .tween(50, 150),
    ),
  ],
  motion: .smooth(damping: 23),
  child: MyWidget(),
)

Asymmetric Expansion

// Expand width while keeping height fixed
Actor(
  acts: [
    .sizedBox(
      width: .tween(80, double.infinity),
      height: .fixed(40),  // Fixed height, no animation
    ),
  ],
  motion: .smooth(damping: 23),
  child: MyWidget(),
)
Inheritance

Constructors

SizedBoxAct({CueMotion? motion, Duration delay = Duration.zero, AnimatableValue<double>? width, AnimatableValue<double>? height, AlignmentGeometry alignment = Alignment.center, ReverseBehavior<Size> reverse = const ReverseBehavior.mirror()})
Animates widget size with optional width and height tweens.
const
SizedBoxAct.keyframed({required Keyframes<Size> frames, Duration delay = Duration.zero, AlignmentGeometry alignment = Alignment.center, KFReverseBehavior<Size> reverse = const KFReverseBehavior.mirror()})
Animates through multiple size keyframes.
const

Properties

alignment AlignmentGeometry
The alignment of the child within the sized box.
final
delay Duration
Delay before this act's forward animation starts.
finalinherited
frames Keyframes<Size>?
Keyframes for size animation.
final
hashCode int
The hash code for this object.
no setter
height AnimatableValue<double>?
The height animation (null means unchanged).
final
key ActKey
The unique identifier for this act type.
final
motion CueMotion?
Per-act motion override. When non-null, replaces the motion inherited from Actor or Cue for this act only.
finalinherited
reverse ReverseBehaviorBase<Size>
Reverse behavior for this act — controls what happens when the animation plays in reverse.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
width AnimatableValue<double>?
The width animation (null means unchanged).
final

Methods

apply(BuildContext context, covariant DeferredCueAnimation<Size> animation, Widget child) Widget
Applies the animated value to child and returns the resulting widget.
applyInternal(BuildContext context, covariant Animation<Object?> animation, Widget child) Widget
Delegates to apply after asserting that animation has the expected type CueAnimation<R>.
inherited
buildAnimation(CueTimeline timline, ActContext context) DeferredCueAnimation<Size>
Builds and registers the animation tracks on timline, returning a CueAnimation that provides the current animated value at each frame.
inherited
buildAnimtable(ActContext context) CueAnimtable<Size>
Assembles the forward and reverse animatables into a single CueAnimtable, wrapping them in a DualAnimatable when a separate reverse animatable is present.
inherited
buildTweens(ActContext context) → (CueAnimtable<Size>, CueAnimtable<Size>?)
Builds the forward and optional reverse CueAnimtables for this act.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolve(ActContext context) ActContext
Merges this act's own motion/delay settings with the inherited ActContext.
override
toString() String
A string representation of this object.
inherited

Operators

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