BoxConstraints forces an infinite width Flutter / Dart Origin: On your device Last updated 4 Nov 2026

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.

Exact message you may see 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
Seen on: Flutter

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

  1. Wrap in Expanded or Flexible
  2. Give a fixed width with SizedBox or ConstrainedBox
  3. Use IntrinsicWidth only for small subtrees

Detailed fix by platform

Flutter

  1. Replace Row(children:[TextField()]) with Row(children:[Expanded(child: TextField())])

How to diagnose

  1. Parent — Row or horizontal scroll?
  2. Child — Needs a width?
  3. 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:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

A RenderFlex overflowed — Flutter: A RenderFlex overflowed by x pixels on the right/bottom (Flutter / Dart)A RenderFlex overflow…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 (Flutter / Dart)A Ticker was active w…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 (Flutter / Dart)A Timer is still pend…Android license status unknown / licenses not accepted — flutter doctor: Android license status unknown. Run `flutter doctor --android-licenses` to accept the SDK licenses (Flutter / Dart)Android license statu…Cleartext HTTP traffic not permitted — Flutter (Android): java.io.IOException: Cleartext HTTP traffic to api.example.com not permitted (Flutter / Dart)Cleartext HTTP traffi…cmdline-tools component is missing — flutter doctor: Android SDK is missing command-line tools; download from https://goo.gl/XxQghQ — cmdline-tools component is missing (Flutter / Dart)cmdline-tools compone…CocoaPods: pod install failed / not installed — Flutter iOS: Error running pod install — CocoaPods not installed or out of date / [!] CocoaPods could not find compatible versions for pod (Flutter / Dart)CocoaPods: pod instal…Dependency requires compileSdk 34 or later — Android Gradle: Execution failed for task ':app:checkDebugAarMetadata'. Dependency requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs (Flutter / Dart)Dependency requires c…BoxConstr…

Explore the map of this error Full error map →

🧠 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.