layout method
layout API.
Implementation
@override
PwBox layout(Context context, BoxConstraints constraints) {
final (String bg, String fg) = _palette(tone);
// Intrinsic chip — avoid Container expand-to-maxWidth when parent is tight.
final PwBox chip = Padding(
padding: padding,
child: DecoratedBox(
decoration: BoxDecoration(color: backgroundColor ?? bg),
child: Text(
label,
softWrap: false,
style: TextStyle(
fontSize: fontSize,
fontWeight: FontWeight.bold,
color: foregroundColor ?? fg,
),
),
),
).layout(context, const BoxConstraints());
return ProxyBox(constraints.constrain(chip.size), child: chip);
}