layout method

  1. @override
ColumnLayout layout(
  1. Widget child,
  2. Context context,
  3. BoxConstraints constraints
)
override

Implementation

@override
ColumnLayout layout(
    Widget child, Context context, BoxConstraints constraints) {
  if (flex != null) {
    return ColumnLayout(0, flex);
  }

  child.layout(context, const BoxConstraints());
  assert(child.box != null);
  final calculatedWidth =
      child.box!.width == double.infinity ? 0.0 : child.box!.width;
  final childFlex = flex ??
      (child is Expanded
          ? child.flex.toDouble()
          : (child.box!.width == double.infinity ? 1 : 0));
  return ColumnLayout(calculatedWidth, childFlex);
}