hiearchy method
Builds the layout using a LayoutBuilder to dynamically adjust the size of
the children based on the available constraints.
Implementation
Widget hiearchy(BuildContext context, List<Widget> children) {
return LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
final hasHeight = constraints.hasBoundedHeight;
final hasWidth = constraints.hasBoundedWidth;
final width = hasWidth ? constraints.maxWidth * flexWidth : suggestedWidth;
final containerHeight = ResponsiveContainer.of(context)?.lastHeight ?? width;
final height = hasHeight ? constraints.maxHeight * flexHeight : containerHeight * suggestedHeight;
return Wrap(
children: children
.map(
(child) => SizedBox(
width: doBoundaries(width, boundariesWidth),
height: doBoundaries(height, boundariesHeight),
child: Padding(
padding: padding,
child: child,
),
),
)
.toList(),
);
},
);
}