layout method
layout API.
Implementation
@override
PwBox layout(Context context, BoxConstraints constraints) {
final double? width = widthFactor == null || !constraints.hasBoundedWidth
? null
: constraints.maxWidth * widthFactor!;
final double? height =
heightFactor == null || !constraints.hasBoundedHeight
? null
: constraints.maxHeight * heightFactor!;
final PwBox box = child.layout(
context,
BoxConstraints(
minWidth: width ?? 0,
maxWidth: width ?? constraints.maxWidth,
minHeight: height ?? 0,
maxHeight: height ?? constraints.maxHeight,
),
);
final PwSize size = constraints.constrain(
PwSize(width ?? box.size.width, height ?? box.size.height),
);
return ProxyBox(
size,
child: box,
childOffset: alignment
.resolve(context.textDirection)
.alongOffset(size, box.size),
);
}