layout method

  1. @override
void layout(
  1. Context context,
  2. BoxConstraints constraints, {
  3. bool parentUsesSize = false,
})
override

First widget pass to calculate the children layout and bounding box

Implementation

@override
void layout(Context context, BoxConstraints constraints,
    {bool parentUsesSize = false}) {
  if (child != null) {
    final childConstraints = constraints.deflate(padding);
    child!.layout(context, childConstraints, parentUsesSize: parentUsesSize);
    assert(child!.box != null);
    box = constraints.constrainRect(
        width: child!.box!.width + padding.horizontal,
        height: child!.box!.height + padding.vertical);
  } else {
    box = constraints.constrainRect(
        width: padding.horizontal, height: padding.vertical);
  }
}