flutter-use-column-row-first
Skill669 starsChanged 3 months agoMITView on GitHub
Use when building any Flutter screen or component to choose responsive Row, Column, Expanded, Flexible, and Spacer layouts before fixed-size or coordinate-based alternatives.
In this repository36 other files it gives its agents.
- AGENTS.mdAGENTS.md
- accessibilitySkill
- architecture-feature-firstSkill
- blocSkill
- code-reviewSkill
- dart-3-updatesSkill
- developing-genkit-dartSkill
- effective-dartSkill
- firebase-aiSkill
- firebase-analyticsSkill
- firebase-app-checkSkill
- firebase-authSkill
- firebase-cloud-firestoreSkill
- firebase-cloud-functionsSkill
- firebase-crashlyticsSkill
- firebase-databaseSkill
- firebase-data-connectSkill
- firebase-in-app-messagingSkill
- firebase-messagingSkill
- firebase-remote-configSkill
- firebase-storageSkill
- flutter-app-architectureSkill
- flutter-best-practicesSkill
- flutter-change-notifierSkill
- flutter-errorsSkill
- flutterfire-configureSkill
- flutter-pre-cachingSkill
- generate-images-with-firebase-aiSkill
- inclusive-designSkill
- mockitoSkill
- mocktailSkill
- patrol-e2e-testingSkill
- providerSkill
- revenuecat-testingSkill
- riverpodSkill
- testingSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
19 rules. About 0 are common, 6 are distinctive, and 13 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
13
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
Start vertical groups with Column and horizontal groups with Row.
- Very specific: line 16
Use Expanded, Flexible, and Spacer to distribute bounded free space.
- Distinctive: line 17
Add padding, alignment, aspect ratio, and constraints intentionally.
- Distinctive: line 18
Test narrow and wide constraints, text scaling, keyboard appearance, and long or localized content.
- Very specific: line 22
Prefer Column for vertical flow and Row for horizontal flow.
- Very specific: line 24
Use Expanded when a child must fill its allocated share of remaining main-axis space.
- Very specific: line 25
Use Flexible when a child may use less than its allocated share.
- Very specific: line 26
Use flex only to express proportional allocation.
- Very specific: line 27
Use Spacer for flexible separation between siblings.
- Very specific: line 29
Use ListView or another scrollable when vertical content can exceed the viewport.
- Very specific: line 30
Use Wrap when horizontal children should move onto another run instead of shrinking or overflowing.
- Very specific: line 31
Use LayoutBuilder, breakpoints, or adaptive widgets when the composition itself must change with available space.
- Very specific: line 32
Use SafeArea when content must avoid system intrusions.
- Distinctive: line 36
Avoid these as default layout mechanisms:
- Distinctive: line 43
Use them when they serve a concrete purpose, such as:
- Very specific: line 55
Put Expanded and Flexible only under Row, Column, or Flex.
- Very specific: line 56
Do not use non-zero flex along an unbounded main axis.
- Distinctive: line 59
Prefer scrolling for content that legitimately exceeds available space.
- Distinctive: line 97
Use the diagrams as structural references, not as fixed pixel templates.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Flutter Use Column Row First
Build responsive Flutter layouts from the constraint system outward. Prefer simple flex composition and introduce fixed dimensions or overlays only when the design requires them for a concrete purpose.
Layout workflow
- Identify each group as primarily vertical, horizontal, overlapping, scrolling, or wrapping.
- Start vertical groups with
Columnand horizontal groups withRow. - Nest small, named widgets instead of building one deeply nested
buildmethod. - Use
Expanded,Flexible, andSpacerto distribute bounded free space. - Add padding, alignment, aspect ratio, and constraints intentionally.
- Test narrow and wide constraints, text scaling, keyboard appearance, and long or localized content.
Rules
- Prefer
Columnfor vertical flow andRowfor horizontal flow. - Control alignment with
mainAxisAlignment,crossAxisAlignment, andmainAxisSize. - Use
Expandedwhen a child must fill its allocated share of remaining main-axis space. - Use
Flexiblewhen a child may use less than its allocated share. - Use
flexonly to express proportional allocation. A child withflex: 2receives twice the free-space share of a sibling withflex: 1. - Use
Spacerfor flexible separation between siblings. UseSizedBoxfor deliberate, fixed gaps. - Wrap text or other variable-width content in
ExpandedorFlexibleinside aRowwhen it must yield space to siblings. - Use
ListViewor another scrollable when vertical content can exceed the viewport;Columndoes not scroll. - Use
Wrapwhen horizontal children should move onto another run instead of shrinking or overflowing. - Use
LayoutBuilder, breakpoints, or adaptive widgets when the composition itself must change with available space. - Use
SafeAreawhen content must avoid system intrusions.
Avoid rigid layouts
Avoid these as default layout mechanisms:
Stackwith hardcodedPositionedcoordinatesContainer,SizedBox, orConstrainedBoxwith hardcoded screen-like width or height- offsets, transforms, or margins used to simulate normal document flow
- screen dimensions copied from a mockup
Use them when they serve a concrete purpose, such as:
- true visual overlap, badges, floating controls, or anchored decoration
- touch-target minimums, icon sizes, thumbnails, or bounded media
- intentional maximum reading width
- aspect-ratio requirements
- platform or design-system constants
State the purpose in the code structure or a brief comment when it is not obvious.
Constraint safety
- Put
ExpandedandFlexibleonly underRow,Column, orFlex. - Do not use non-zero flex along an unbounded main axis. In a vertical scrollable, remove vertical
ExpandedorFlexible, or establish a meaningful finite constraint. - Fix a nested
Columnthat needs the outer column's remaining height by wrapping the inner column inExpanded. - Diagnose overflow by inspecting constraints and variable content before adding clipping or smaller hardcoded sizes.
- Prefer scrolling for content that legitimately exceeds available space.
Preferred pattern
Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const Header(),
const SizedBox(height: 16),
Expanded(
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const Flexible(flex: 2, child: PrimaryContent()),
const SizedBox(width: 16),
const Flexible(child: SecondaryContent()),
],
),
),
const SizedBox(height: 16),
const Actions(),
],
),
)Change this composition at a breakpoint if the horizontal content cannot remain usable on a narrow screen; do not merely squeeze it.
Visual references
Inspect these diagrams when decomposing a mockup into nested flex layouts:
- Pavlova Row and Column layout shows the overall horizontal
Rowcontaining a vertical contentColumnand an image. - Nested Row and Column diagram shows smaller rating and icon groups decomposed into nested
RowandColumnwidgets.
Use the diagrams as structural references, not as fixed pixel templates.
Verification
- Confirm no RenderFlex overflow at supported viewport sizes.
- Confirm text wraps or truncates intentionally.
- Confirm flexible children receive bounded constraints.
- Confirm scrollable content remains reachable.
- Confirm fixed sizes and
StackorPositionedusages have a concrete design reason.
Sources
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

