TransformModifier.rotate constructor

TransformModifier.rotate({
  1. Key? key,
  2. Widget? child,
  3. Key? modifierKey,
  4. required double angle,
  5. Offset? origin,
  6. AlignmentGeometry? alignment = Alignment.center,
  7. bool transformHitTests = true,
  8. FilterQuality? filterQuality,
})

Creates a widget that transforms its child using a rotation around the center.

The angle argument must not be null. It gives the rotation in clockwise radians.

{@tool snippet}

This example rotates an orange box containing text around its center by fifteen degrees.

Transform.rotate(
  angle: -math.pi / 12.0,
  child: Container(
    padding: const EdgeInsets.all(8.0),
    color: const Color(0xFFE8581C),
    child: const Text('Apartment for rent!'),
  ),
)

{@end-tool}

See also:

Implementation

TransformModifier.rotate({
  super.key,
  super.child,
  super.modifierKey,
  required double angle,
  this.origin,
  this.alignment = Alignment.center,
  this.transformHitTests = true,
  this.filterQuality,
}) : transform = _computeRotation(angle);