build method
Builds the layout widget corresponding to the type, rendering Row, Column, Stack, or Wrap.
Configures minimal sizing and alignments for compact, centered displays; applies 8-unit spacing to wraps. Converts iterable children to lists for widget compatibility, ensuring seamless integration with Arcane components like PanelButton in rows or IconButton in stacks without state management.
Implementation
@override
Widget build(BuildContext context) => switch (type) {
FlowType.row => Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: children is List<Widget>
? children as List<Widget>
: children.toList()),
FlowType.column => Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: children is List<Widget>
? children as List<Widget>
: children.toList()),
FlowType.stack => Stack(
fit: StackFit.passthrough,
children: children is List<Widget>
? children as List<Widget>
: children.toList(),
),
FlowType.wrap => Wrap(
spacing: 8,
runSpacing: 8,
crossAxisAlignment: WrapCrossAlignment.center,
runAlignment: WrapAlignment.center,
alignment: WrapAlignment.center,
children: children is List<Widget>
? children as List<Widget>
: children.toList(),
),
};