AnimatedScale class Null safety

Animated version of Transform.scale which automatically transitions the child's scale over a given duration whenever the given scale changes.

This code defines a widget that uses AnimatedScale to change the size of FlutterLogo gradually to a new scale whenever the button is pressed.
class LogoScale extends StatefulWidget {
  const LogoScale({super.key});

  State<LogoScale> createState() => LogoScaleState();

class LogoScaleState extends State<LogoScale> {
  double scale = 1.0;

  void _changeScale() {
    setState(() => scale = scale == 1.0 ? 3.0 : 1.0);

  Widget build(BuildContext context) {
    return Column(
      children: <Widget>[
          onPressed: _changeScale,
          child: const Text('Scale Logo'),
          padding: const EdgeInsets.all(50),
          child: AnimatedScale(
            scale: scale,
            duration: const Duration(seconds: 2),
            child: const FlutterLogo(),

See also:

  • AnimatedRotation, for animating the rotation of a child.
  • AnimatedSize, for animating the resize of a child based on changes in layout.
  • AnimatedSlide, for animating the translation of a child by a given offset relative to its size.
  • ScaleTransition, an explicitly animated version of this widget, where an Animation is provided by the caller instead of being built in.


AnimatedScale({Key? key, Widget? child, required double scale, Alignment alignment =, FilterQuality? filterQuality, Curve curve = Curves.linear, required Duration duration, VoidCallback? onEnd})
Creates a widget that animates its scale implicitly.


alignment Alignment
The alignment of the origin of the coordinate system in which the scale takes place, relative to the size of the box.
child Widget?
The widget below this widget in the tree.
curve Curve
The curve to apply when animating the parameters of this container.
final, inherited
duration Duration
The duration over which to animate the parameters of this container.
final, inherited
filterQuality FilterQuality?
The filter quality with which to apply the transform as a bitmap operation.
hashCode int
The hash code for this object.
@nonVirtual, read-only, inherited
key Key?
Controls how one widget replaces another widget in the tree.
final, inherited
onEnd VoidCallback?
Called every time an animation completes.
final, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
scale double
The target scale.


createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
createState() ImplicitlyAnimatedWidgetState<AnimatedScale>
Creates the mutable state for this widget at a given location in the tree.
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
@protected, inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
toString({DiagnosticLevel minLevel =}) String
A string representation of this object.
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
toStringShort() String
A short, textual description of this widget.


operator ==(Object other) bool
The equality operator.
@nonVirtual, inherited