AnimatedContainer constructor

AnimatedContainer(
  1. {Key key,
  2. AlignmentGeometry alignment,
  3. EdgeInsetsGeometry padding,
  4. Color color,
  5. Decoration decoration,
  6. Decoration foregroundDecoration,
  7. double width,
  8. double height,
  9. BoxConstraints constraints,
  10. EdgeInsetsGeometry margin,
  11. Matrix4 transform,
  12. Widget child,
  13. Curve curve: Curves.linear,
  14. @required Duration duration,
  15. VoidCallback onEnd}
)

Creates a container that animates its parameters implicitly.

The curve and duration arguments must not be null.

Implementation

AnimatedContainer({
  Key key,
  this.alignment,
  this.padding,
  Color color,
  Decoration decoration,
  this.foregroundDecoration,
  double width,
  double height,
  BoxConstraints constraints,
  this.margin,
  this.transform,
  this.child,
  Curve curve = Curves.linear,
  @required Duration duration,
  VoidCallback onEnd,
}) : assert(margin == null || margin.isNonNegative),
     assert(padding == null || padding.isNonNegative),
     assert(decoration == null || decoration.debugAssertIsValid()),
     assert(constraints == null || constraints.debugAssertIsValid()),
     assert(color == null || decoration == null,
       'Cannot provide both a color and a decoration\n'
       'The color argument is just a shorthand for "decoration: BoxDecoration(color: color)".'
     ),
     decoration = decoration ?? (color != null ? BoxDecoration(color: color) : null),
     constraints =
      (width != null || height != null)
        ? constraints?.tighten(width: width, height: height)
          ?? BoxConstraints.tightFor(width: width, height: height)
        : constraints,
     super(key: key, curve: curve, duration: duration, onEnd: onEnd);