Responsive row
Skill goldenm-software/layrz_theme/.claude/skills/responsive-row
Use ResponsiveRow in a layrz Flutter widget. Apply when wrapping ResponsiveCol children in a responsive 12-column grid container.From its SKILL.md
npx -y skills add goldenm-software/layrz_theme --skill responsive-rowAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 8 stars8 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
3.6 KB, as published. Nobody here has run it
Dart syntax: This library requires Dart ≥ 3.10. Use dot shorthand for all enum values (e.g.
.col6,.start,.left) — never write the fully-qualified form (Sizes.col6,WrapAlignment.start).
Full constructor and examples: read
references/api.mdin this skill's directory.
When to use
- Wrapping a set of
ResponsiveColchildren in a flex container that reflows automatically - Needs spacing, horizontal alignment, or vertical alignment between columns
- Building from a dynamic list → use
ResponsiveRow.builder
Always paired with ResponsiveCol as children. For breakpoint logic and Sizes enum, see the responsive-col skill.
Minimal usage
ResponsiveRow(
children: [
ResponsiveCol(xs: .col12, md: .col6, child: WidgetA()),
ResponsiveCol(xs: .col12, md: .col6, child: WidgetB()),
],
)
Key behaviors
- Renders as
SizedBox(width: double.infinity, child: LayoutBuilder(...))— uses a Column of Rows internally; LayoutBuilder provides the total row width for per-child sizing calculations. The internal Wrap-based implementation was replaced in v7.5.33 to enforce true gaps. childrenonly acceptsList<ResponsiveCol>— useResponsiveCol(child: Divider())for dividers.buildertakesResponsiveCol Function(int)— notWidget Function(BuildContext, int).spacingapplies to both axes: horizontal gap between columns in the same row, and vertical gap between rows when columns wrap (default0). As of v7.5.33, spacing is a TRUE pixel gap:availableWidth = totalWidth - spacing * (n - 1), then each child's width =(availableWidth / 12) * gridSize. Two col6 children with spacing=12 each receive(totalWidth - 12) / 2pixels — nottotalWidth / 2 - 6.
Common patterns
// With spacing and center alignment
ResponsiveRow(
spacing: 16,
mainAxisAlignment: .center,
crossAxisAlignment: .center,
children: [
ResponsiveCol(xs: .col12, md: .col6, child: WidgetA()),
ResponsiveCol(xs: .col12, md: .col6, child: WidgetB()),
],
)
// Dynamic list with builder
ResponsiveRow.builder(
spacing: 16,
itemCount: items.length,
itemBuilder: (index) => ResponsiveCol(
xs: .col12,
sm: .col6,
lg: .col4,
child: ItemCard(item: items[index]),
),
)
// Fully responsive breakpoint reflow — 1/2/3/4 cols across breakpoints
ResponsiveRow(
spacing: 12,
children: [
for (final item in items)
ResponsiveCol(
xs: .col12, // mobile: 1 column
sm: .col6, // small: 2 columns
md: .col4, // medium: 3 columns
lg: .col3, // large: 4 columns
child: ItemCard(item: item),
),
],
)
Pitfalls
- Do not place
ResponsiveColoutside aResponsiveRow. It renders as a pass-through and will receive whatever width its parent provides, which is almost never correct. - Do not wrap
ResponsiveRowin an unbounded-width parent (e.g. a horizontalListView). The row needs a finite width to compute gridSize. childrenonly acceptsList<ResponsiveCol>. Raw widgets won't compile. For dividers/spacers useconst ResponsiveCol(child: Divider()).- Spacing > 0 is a TRUE gap — it does NOT reduce each child's gridSize. Two
.col6withspacing: 12fit on one row; the gap is carved fromtotalWidthbefore distributing the 12-column grid. - Do not nest
ResponsiveRowinside anotherResponsiveRowwithout awareness that spacing is applied per-row independently.