wrapWithPadding function
List<Widget>
wrapWithPadding(
- BaseNode node,
- List<Widget> children, {
- required AlignmentModel stackAlignment,
- bool applyPadding = true,
})
Implementation
List<Widget> wrapWithPadding(
BaseNode node,
List<Widget> children, {
required AlignmentModel stackAlignment,
bool applyPadding = true,
}) {
if (children.isEmpty || !applyPadding) return children;
final EdgeInsets resolvedPadding =
node.innerBoxLocal.edgeInsets.flutterEdgeInsets;
if (resolvedPadding == EdgeInsets.zero) {
return children;
}
return [
// This adaptive box forces the Stack to respect the configurations of its
// associated [node]. Without it, the Stack can produce cases where it
// wraps around its concrete child tightly instead of expanding from a
// SizeFit.expand.
AdaptiveNodeBox(
node: node,
child: Padding(
padding: resolvedPadding,
child: Stack(
clipBehavior: Clip.none,
alignment:
stackAlignment.flutterAlignment ?? AlignmentDirectional.topStart,
children: children,
),
),
),
];
}