build method
자식을 행과 열로 나누어 배치한다.
Implementation
@override
Widget build(BuildContext context) {
return Column(
children: [
for (
var rowIndex = 0;
rowIndex < (children.length / crossAxisCount).ceil();
rowIndex++
) ...[
if (rowIndex > 0) SizedBox(height: mainAxisSpacing),
IntrinsicHeight(
child: Row(
children: [
for (
var columnIndex = 0;
columnIndex < crossAxisCount;
columnIndex++
) ...[
if (columnIndex > 0) SizedBox(width: crossAxisSpacing),
Expanded(
child:
children.length >
rowIndex * crossAxisCount + columnIndex
? children[rowIndex * crossAxisCount + columnIndex]
: const SizedBox(),
),
],
],
),
),
],
],
);
}