measure method

  1. @override
({double flex, double width}) measure(
  1. Widget child,
  2. Context context,
  3. BoxConstraints constraints
)
override

Intrinsic or fixed contribution before flex distribution.

Implementation

@override
({double width, double flex}) measure(
  Widget child,
  Context context,
  BoxConstraints constraints,
) {
  if (flex != null) {
    return (width: 0, flex: flex!);
  }
  final PwBox box = child.layout(context, const BoxConstraints());
  final double w = box.size.width.isFinite ? box.size.width : 0;
  return (width: w, flex: w <= 0 ? 1 : 0);
}