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}) {
  final resolvedPadding = padding.resolve(Directionality.of(context));
  if (child != null) {
    final childConstraints = constraints.deflate(resolvedPadding);
    child!.layout(context, childConstraints, parentUsesSize: parentUsesSize);
    assert(child!.box != null);
    box = constraints.constrainRect(
        width: child!.box!.width + resolvedPadding.horizontal,
        height: child!.box!.height + resolvedPadding.vertical);
  } else {
    box = constraints.constrainRect(
        width: resolvedPadding.horizontal, height: resolvedPadding.vertical);
  }
}