Skip to content

Commit f201a31

Browse files
committed
Fix issues with static sized repeat grids
Issue #97
1 parent a3696cf commit f201a31

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/core/nodes/grid.js

+12-11
Original file line numberDiff line numberDiff line change
@@ -74,21 +74,22 @@ class Grid extends AbstractNode {
7474
ctx.log.warn("Partial columns are not supported in repeat grids.", o);
7575
}
7676

77-
// TODO: GS: when .responsive is false, we likely have to wrap this in a SizedBox
78-
79-
if (!itemIsResponsive) {
80-
return `SingleChildScrollView(child: Wrap(` +
77+
let str = itemIsResponsive ?
78+
`GridView.count(` +
79+
`mainAxisSpacing: ${ySpacing}, crossAxisSpacing: ${xSpacing}, ` +
80+
`crossAxisCount: ${colCount}, ` +
81+
`childAspectRatio: ${aspectRatio}, ` +
82+
`children: [${childDataStr}].map((map) { ${paramVarStr} return ${itemStr}; }).toList(),` +
83+
')'
84+
:
85+
`SingleChildScrollView(child: Wrap(` +
8186
'alignment: WrapAlignment.center, ' +
8287
`spacing: ${xSpacing}, runSpacing: ${ySpacing}, ` +
8388
`children: [${childDataStr}].map((map) { ${paramVarStr} return ${itemStr}; }).toList(),` +
8489
'), )';
85-
}
86-
return `GridView.count(` +
87-
`mainAxisSpacing: ${ySpacing}, crossAxisSpacing: ${xSpacing}, ` +
88-
`crossAxisCount: ${colCount}, ` +
89-
`childAspectRatio: ${aspectRatio}, ` +
90-
`children: [${childDataStr}].map((map) { ${paramVarStr} return ${itemStr}; }).toList(),` +
91-
')';
90+
91+
if (!this.responsive) { str = this._addSizedBox(str, this.xdNode.localBounds, ctx); }
92+
return str;
9293
}
9394

9495
_itemIsResponsive() {

0 commit comments

Comments
 (0)