alignment property

  1. @override
AlignmentGeometry alignment
final

How to align the image within its bounds.

The alignment aligns the given position in the image to the given position in the layout bounds. For example, an Alignment alignment of (-1.0, -1.0) aligns the image to the top-left corner of its layout bounds, while an value of Alignment(1.0, 1.0) aligns the bottom right of the image with the bottom right corner of its layout bounds. Similarly, an alignment of (0.0, 1.0) aligns the bottom middle of the image with the middle of the bottom edge of its layout bounds.

Ignored and forced Alignment.center if repeat is set to Repeat.mirror, Repeat.mirrorX, or Repeat.mirrorY.

  • To align/position the seamlessly-tiling image in this situation, employ an Offset in the mirrorOffset field.
  • This is a workaround for now.

To display a subpart of an image, consider using a CustomPainter and Canvas.drawImageRect.

If the alignment is TextDirection-dependent (i.e. if it is a AlignmentDirectional), then a TextDirection must be available when the image is painted.

Defaults to Alignment.center.

See also:

Implementation

@override
final AlignmentGeometry alignment;