layout method

void layout(
  1. BoxConstraints c, {
  2. bool parentUsesSize = false,
})
inherited

Lays this object out within c. A parent whose layout reads this object's size passes parentUsesSize. Otherwise, or when c is tight or the object is sizedByParent, its size can't change the parent's layout: the object is a relayout boundary, where markNeedsLayout inside it stops.

Implementation

void layout(BoxConstraints c, {bool parentUsesSize = false}) {
  final same = !_needsLayout && c == _constraints;
  // before the boundary, which an object sized by its parent only within
  // some constraints reads them for
  _constraints = c;
  // decided by every call, even one that has nothing to lay out
  _relayoutBoundary =
      !parentUsesSize || c.isTight || sizedByParent || parent == null;
  if (same) {
    return;
  }
  _layOut(c);
  _needsLayout = false;
  // children may have moved, resized or been replaced: what was painted
  // before can't be trusted
  markNeedsPaint();
}