Transform.scale constructor

Transform.scale(
  1. {Key key,
  2. @required double scale,
  3. Offset origin,
  4. AlignmentGeometry alignment: Alignment.center,
  5. bool transformHitTests: true,
  6. Widget child}
)

Creates a widget that scales its child uniformly.

The scale argument must not be null. It gives the scalar by which to multiply the x and y axes.

The alignment controls the origin of the scale; by default, this is the center of the box.

This example shrinks an orange box containing text such that each dimension is half the size it would otherwise be.
Transform.scale(
  scale: 0.5,
  child: Container(
    padding: const EdgeInsets.all(8.0),
    color: const Color(0xFFE8581C),
    child: const Text('Bad Idea Bears'),
  ),
)

See also:

  • ScaleTransition, which animates changes in scale smoothly over a given duration.

Implementation

Transform.scale({
  Key key,
  @required double scale,
  this.origin,
  this.alignment = Alignment.center,
  this.transformHitTests = true,
  Widget child,
}) : transform = Matrix4.diagonal3Values(scale, scale, 1.0),
     super(key: key, child: child);