Flutter: BoxConstraints forces an infinite width. These invalid constraints were provided to RenderStack's layout() function (TextField in a Row)
A widget that needs a finite width, like a TextField or Container with no size, was placed where the parent offers unlimited width.
BoxConstraints forces an infinite widthInputDecorator cannot have an unbounded width'package:flutter/src/rendering/box.dart': Failed assertion: 'constraints.hasBoundedWidth'An InputDecorator, which is typically created by a TextField, cannot have an unbounded widthBoxConstraints forces an infinite height Meaning
Row provides unbounded width to its children. A TextField tries to expand to the maximum, so it fails with an infinite width error. Constrain it with Expanded, Flexible or a SizedBox(width: …). The same applies to ListTile in a Row.
Common causes
- TextField/TextFormField inside a Row without Expanded
- ListTile or Card in a horizontal scroller without width
- Container(width: double.infinity) in an unbounded parent
- InputDecorator in Row
- Stack child with infinite constraints
⚡ Quick fix
- Wrap in
ExpandedorFlexible - Give a fixed width with
SizedBoxorConstrainedBox - Use
IntrinsicWidthonly for small subtrees
Detailed fix by platform
Flutter
- Replace
Row(children:[TextField()])withRow(children:[Expanded(child: TextField())])
How to diagnose
- Parent — Row or horizontal scroll?
- Child — Needs a width?
- Fix — Expanded/SizedBox?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- A RenderFlex overflowed Flutter: A RenderFlex overflowed by x pixels on the right/bottom
- A Ticker was active when the State was disposed Flutter: _HomeState#abc(ticker active) was disposed with an active Ticker. State.dispose() implementations must call dispose() on all their AnimationControllers
- A Timer is still pending even after the widget tree was disposed Flutter test: A Timer is still pending even after the widget tree was disposed
Most viewed in Flutter / Dart
- setState() called after dispose() Flutter: setState() called after dispose(): _MyState#1a2b3 (lifecycle state: defunct, not mounted)
- Null check operator used on a null value Dart/Flutter: Null check operator used on a null value
- Unsupported class file major version (Gradle / Java) Android Gradle: Execution failed — Unsupported class file major version 65 / Android Gradle plugin requires Java 17 to run
Other ways to find it
Where this error sits
Origin: On your device. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 4 Nov 2026