TransformModifier.translate constructor

TransformModifier.translate({
  1. Key? key,
  2. Widget? child,
  3. Key? modifierKey,
  4. required Offset offset,
  5. bool transformHitTests = true,
  6. FilterQuality? filterQuality,
})

Creates a widget that transforms its child using a translation.

The offset argument must not be null. It specifies the translation.

{@tool snippet}

This example shifts the silver-colored child down by fifteen pixels.

Transform.translate(
  offset: const Offset(0.0, 15.0),
  child: Container(
    padding: const EdgeInsets.all(8.0),
    color: const Color(0xFF7F7F7F),
    child: const Text('Quarter'),
  ),
)

{@end-tool}

Implementation

TransformModifier.translate({
  super.key,
  super.child,
  super.modifierKey,
  required Offset offset,
  this.transformHitTests = true,
  this.filterQuality,
})  : transform = Matrix4.translationValues(offset.dx, offset.dy, 0.0),
      origin = null,
      alignment = null;