AlignComponent constructor
AlignComponent({
- PositionComponent? child,
- Anchor alignment = Anchor.topLeft,
- double? widthFactor,
- double? heightFactor,
- bool keepChildAnchor = false,
Creates a component that keeps its child
positioned according to the
alignment
within this component's bounding box.
More precisely, the child will be placed at alignment
relative position
within the current component's bounding box. The child's anchor will also
be set to the alignment
, unless keepChildAnchor
parameter is true.
Implementation
AlignComponent({
PositionComponent? child,
Anchor alignment = Anchor.topLeft,
this.widthFactor,
this.heightFactor,
this.keepChildAnchor = false,
}) {
this.alignment = alignment;
this.child = child;
}