Transform.flip constructor

Transform.flip({
  1. Key? key,
  2. bool flipX = false,
  3. bool flipY = false,
  4. Offset? origin,
  5. bool transformHitTests = true,
  6. FilterQuality? filterQuality,
  7. Widget? child,
})

Creates a widget that mirrors its child about the widget's center point.

If flipX is true, the child widget will be flipped horizontally. Defaults to false.

If flipY is true, the child widget will be flipped vertically. Defaults to false.

If both are true, the child widget will be flipped both vertically and horizontally, equivalent to a 180 degree rotation.

This example flips the text horizontally.
link
Transform.flip(
  flipX: true,
  child: const Text('Horizontal Flip'),
)

Implementation

Transform.flip({
    super.key,
    bool flipX = false,
    bool flipY = false,
    this.origin,
    this.transformHitTests = true,
    this.filterQuality,
    super.child,
})  : alignment = Alignment.center,
      transform = Matrix4.diagonal3Values(flipX ? -1.0 : 1.0, flipY ? -1.0 : 1.0, 1.0);