AnimatedCrossFade constructor Null safety

const AnimatedCrossFade(
  1. {Key? key,
  2. required Widget firstChild,
  3. required Widget secondChild,
  4. Curve firstCurve = Curves.linear,
  5. Curve secondCurve = Curves.linear,
  6. Curve sizeCurve = Curves.linear,
  7. AlignmentGeometry alignment = Alignment.topCenter,
  8. required CrossFadeState crossFadeState,
  9. required Duration duration,
  10. Duration? reverseDuration,
  11. AnimatedCrossFadeBuilder layoutBuilder = defaultLayoutBuilder,
  12. bool excludeBottomFocus = true}
)

Creates a cross-fade animation widget.

The duration of the animation is the same for all components (fade in, fade out, and size), and you can pass Intervals instead of Curves in order to have finer control, e.g., creating an overlap between the fades.

All the arguments other than key must be non-null.

Implementation

const AnimatedCrossFade({
  super.key,
  required this.firstChild,
  required this.secondChild,
  this.firstCurve = Curves.linear,
  this.secondCurve = Curves.linear,
  this.sizeCurve = Curves.linear,
  this.alignment = Alignment.topCenter,
  required this.crossFadeState,
  required this.duration,
  this.reverseDuration,
  this.layoutBuilder = defaultLayoutBuilder,
  this.excludeBottomFocus = true,
}) : assert(firstChild != null),
     assert(secondChild != null),
     assert(firstCurve != null),
     assert(secondCurve != null),
     assert(sizeCurve != null),
     assert(alignment != null),
     assert(crossFadeState != null),
     assert(duration != null),
     assert(layoutBuilder != null),
     assert(excludeBottomFocus != null);