alignChild method

  1. @protected
void alignChild()

Apply the current alignment to the child.

Subclasses should call this method if they have a child, to have this class perform the actual alignment. If there is no child, do not call this method.

This method must be called after the child has been laid out and this object's own size has been set.

Implementation

@protected
void alignChild() {
  _resolve();
  assert(child != null);
  assert(!child!.debugNeedsLayout);
  assert(child!.hasSize);
  assert(hasSize);
  assert(_resolvedAlignment != null);
  final BoxParentData childParentData = child!.parentData! as BoxParentData;
  childParentData.offset = _resolvedAlignment!.alongOffset(size - child!.size as Offset);
}