Schmidt Nest πŸš€

Flutter RenderBox was not laid out

April 4, 2025

πŸ“‚ Categories: Dart
Flutter RenderBox was not laid out

Flutter, a almighty transverse-level UI toolkit, empowers builders to trade gorgeous, natively compiled functions for cell, net, and desktop from a azygous codebase. Nevertheless, equal seasoned Flutter builders often brush the irritating “RenderBox was not laid retired” mistake. This cryptic communication tin halt improvement and pb to hours of debugging. This blanket usher dives heavy into the causes of this communal mistake, offering actionable options and preventative methods to support your Flutter initiatives moving easily. Knowing the underlying rules of Flutter’s structure scheme is cardinal to conquering this situation and gathering strong, pixel-clean UIs.

Knowing the RenderBox

Successful Flutter, all UI component is a widget. Widgets are immutable descriptions of the UI. Down the scenes, Flutter makes use of a rendering actor composed of RenderObjects to negociate structure and coating. A RenderBox is a circumstantial kind of RenderObject liable for sizing and positioning container-similar widgets. The “RenderBox was not laid retired” mistake arises once a RenderBox doesn’t have the essential constraints from its genitor widget to find its measurement and assumption.

This frequently occurs owed to unbounded constraints, wherever a widget makes an attempt to grow infinitely inside a genitor that doesn’t supply limitations. Deliberation of a File oregon Line with out immoderate constraints wrong a genitor that affords limitless abstraction. The kid widgets attempt to enough each disposable abstraction, starring to the mistake. Knowing the relation betwixt genitor and kid widgets successful the format hierarchy is important for resolving this content.

β€œConstraints spell behind. Sizes spell ahead. Genitor units assumption.” – This concise message from the Flutter documentation absolutely encapsulates the format procedure. Mother and father enforce constraints connected their youngsters, kids find their sizes primarily based connected these constraints, and past the genitor positions them accordingly.

Communal Causes and Options

Respective communal situations set off the “RenderBox was not laid retired” mistake. Fto’s research these situations and their respective options:

  • Unconstrained Expanded widgets: An Expanded widget makes an attempt to enough each disposable abstraction on the chief axis of its genitor (Line oregon File). If aggregate Expanded widgets be with out circumstantial flex elements inside an unbounded genitor, they vie for abstraction, ensuing successful the mistake. Resolution: Delegate flex elements to all Expanded widget to power their comparative sizes, oregon constrain the genitor widget.
  • Unbounded SizedBox/Instrumentality: A SizedBox oregon Instrumentality with out specific dimensions inside an unbounded genitor volition besides effort to grow infinitely. Resolution: Supply circumstantial tallness and width values, oregon usage constraints similar BoxConstraints to bounds their measurement.

Illustration: Fixing an Unconstrained File

See this problematic codification:

File( kids: [ Matter('Any matter'), Expanded(kid: Instrumentality()), // Unconstrained Expanded ], ) 

To hole this, constrain the File’s tallness oregon supply a flex cause to the Expanded widget:

SizedBox( tallness: 200, // Constrained tallness kid: File( youngsters: [ Matter('Any matter'), Expanded(kid: Instrumentality()), ], ), ) 

Leveraging Flutter’s Structure Widgets

Flutter gives a affluent fit of structure widgets designed to negociate constraints efficaciously. Widgets similar ConstrainedBox, SizedBox, AspectRatio, and LimitedBox supply good-grained power complete widget dimensions. Mastering these instruments is indispensable for stopping format points. For illustration, wrapping a widget with a ConstrainedBox permits you to enforce minimal and most width and tallness constraints, stopping unbounded enlargement.

Knowing the antithetic format fashions, similar container constraints, intrinsic sizing, and slivers, additional strengthens your quality to physique analyzable and responsive UIs. Exploring the authoritative Flutter structure documentation gives invaluable insights into these ideas.

Utilizing LayoutBuilder tin besides beryllium generous. This widget permits you to entree the constraints handed behind from its genitor, enabling you to dynamically set the structure based mostly connected disposable abstraction. This is peculiarly utile for creating responsive designs that accommodate to antithetic surface sizes.

Debugging Methods

Once confronted with the “RenderBox was not laid retired” mistake, effectual debugging methods are important. Flutter’s DevTools suite gives almighty instruments for inspecting the widget actor, visualizing format constraints, and figuring out the problematic widget. The ‘Flutter Inspector’ inside DevTools permits you to research the widget hierarchy, position properties, and diagnose format points visually.

  1. Unfastened DevTools successful your browser.
  2. Choice the ‘Flutter Inspector’ tab.
  3. Examine the widget actor and analyze the constraints of all widget.

Including debug mark statements inside your format codification tin supply invaluable insights into the constraints being handed behind the widget actor. Printing the constraints acquired by a widget tin aid pinpoint wherever the unbounded constraints originate. Moreover, utilizing the debugPaintSizeEnabled emblem tin visually detail the boundaries of all RenderBox, making it simpler to place format discrepancies.

Stopping Early Errors

Adopting a proactive attack to format plan tin importantly trim the prevalence of “RenderBox was not laid retired” errors. Cautiously see the constraints utilized to all widget and guarantee that each widgets inside unbounded dad and mom person specific dimension limitations. Recurrently investigating your UI connected antithetic surface sizes and gadgets helps place possible structure points aboriginal successful the improvement procedure. By incorporating these champion practices into your workflow, you tin make sturdy and adaptable Flutter functions that are escaped from format-associated frustrations.

This heavy dive into the “RenderBox was not laid retired” mistake has outfitted you with the cognition and instruments to efficaciously sort out this communal Flutter situation. By knowing the intricacies of Flutter’s structure scheme, leveraging its almighty structure widgets, and using effectual debugging methods, you tin physique sturdy, pixel-clean person interfaces that delight your customers. Retrieve to cheque retired sources similar the authoritative Flutter documentation and assemblage boards for additional aid. Present, spell away and physique astonishing Flutter apps!

FAQ

Q: What is a RenderBox successful Flutter?

A: A RenderBox is a kind of RenderObject successful Flutter that’s liable for sizing and positioning container-similar widgets successful the rendering actor.

Question & Answer :
I’m making an attempt to make a ListView however once I import the list_form.dart people i acquire this mistake. Possibly I made any errors with the structure due to the fact that if I attempt to tally it wrong the chief record I don’t acquire this mistake.

This is the mistake:

I/flutter (12956): ══║ Objection CAUGHT BY RENDERING Room β•žβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β• I/flutter (12956): The pursuing assertion was thrown throughout performResize(): I/flutter (12956): Vertical viewport was fixed unbounded tallness. I/flutter (12956): Viewports grow successful the scrolling absorption to enough their instrumentality.Successful this lawsuit, a vertical I/flutter (12956): viewport was fixed an limitless magnitude of vertical abstraction successful which to grow. This occupation I/flutter (12956): usually occurs once a scrollable widget is nested wrong different scrollable widget. I/flutter (12956): If this widget is ever nested successful a scrollable widget location is nary demand to usage a viewport due to the fact that I/flutter (12956): location volition ever beryllium adequate vertical abstraction for the youngsters. Successful this lawsuit, see utilizing a File I/flutter (12956): alternatively. Other, see utilizing the "shrinkWrap" place (oregon a ShrinkWrappingViewport) to measurement I/flutter (12956): the tallness of the viewport to the sum of the heights of its youngsters. I/flutter (12956): I/flutter (12956): Once the objection was thrown, this was the stack: I/flutter (12956): #zero RenderViewport.performResize.<nameless closure> (bundle:flutter/src/rendering/viewport.dart:1133:15) I/flutter (12956): #1 RenderViewport.performResize (bundle:flutter/src/rendering/viewport.dart:1186:6) I/flutter (12956): #2 RenderObject.structure (bundle:flutter/src/rendering/entity.dart:1616:9) I/flutter (12956): #three _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (bundle:flutter/src/rendering/proxy_box.dart:108:thirteen) I/flutter (12956): #four RenderObject.format (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #5 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (bundle:flutter/src/rendering/proxy_box.dart:108:thirteen) I/flutter (12956): #6 RenderObject.structure (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #7 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (bundle:flutter/src/rendering/proxy_box.dart:108:thirteen) I/flutter (12956): #eight RenderObject.structure (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #9 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (bundle:flutter/src/rendering/proxy_box.dart:108:thirteen) I/flutter (12956): #10 RenderObject.structure (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #eleven _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (bundle:flutter/src/rendering/proxy_box.dart:108:thirteen) I/flutter (12956): #12 RenderObject.structure (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #thirteen _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (bundle:flutter/src/rendering/proxy_box.dart:108:thirteen) I/flutter (12956): #14 RenderObject.structure (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #15 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (bundle:flutter/src/rendering/proxy_box.dart:108:thirteen) I/flutter (12956): #sixteen RenderObject.structure (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #17 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (bundle:flutter/src/rendering/proxy_box.dart:108:thirteen) I/flutter (12956): #18 RenderObject.structure (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #19 RenderFlex.performLayout (bundle:flutter/src/rendering/flex.dart:738:15) I/flutter (12956): #20 RenderObject.structure (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #21 RenderFlex.performLayout (bundle:flutter/src/rendering/flex.dart:738:15) I/flutter (12956): #22 RenderObject.structure (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #23 RenderPositionedBox.performLayout (bundle:flutter/src/rendering/shifted_box.dart:381:thirteen) I/flutter (12956): #24 RenderObject.format (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #25 MultiChildLayoutDelegate.layoutChild (bundle:flutter/src/rendering/custom_layout.dart:141:eleven) I/flutter (12956): #26 _ScaffoldLayout.performLayout (bundle:flutter/src/worldly/scaffold.dart:339:7) I/flutter (12956): #27 MultiChildLayoutDelegate._callPerformLayout (bundle:flutter/src/rendering/custom_layout.dart:211:7) I/flutter (12956): #28 RenderCustomMultiChildLayoutBox.performLayout (bundle:flutter/src/rendering/custom_layout.dart:355:14) I/flutter (12956): #29 RenderObject.structure (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #30 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (bundle:flutter/src/rendering/proxy_box.dart:108:thirteen) I/flutter (12956): #31 RenderObject.format (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #32 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (bundle:flutter/src/rendering/proxy_box.dart:108:thirteen) I/flutter (12956): #33 _RenderCustomClip.performLayout (bundle:flutter/src/rendering/proxy_box.dart:1192:eleven) I/flutter (12956): #34 RenderObject.format (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #35 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (bundle:flutter/src/rendering/proxy_box.dart:108:thirteen) I/flutter (12956): #36 RenderObject.format (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #37 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (bundle:flutter/src/rendering/proxy_box.dart:108:thirteen) I/flutter (12956): #38 _RenderCustomClip.performLayout (bundle:flutter/src/rendering/proxy_box.dart:1192:eleven) I/flutter (12956): #39 RenderObject.format (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #forty _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (bundle:flutter/src/rendering/proxy_box.dart:108:thirteen) I/flutter (12956): #forty one RenderObject.format (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #forty two _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (bundle:flutter/src/rendering/proxy_box.dart:108:thirteen) I/flutter (12956): #forty three RenderObject.structure (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #forty four _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (bundle:flutter/src/rendering/proxy_box.dart:108:thirteen) I/flutter (12956): #forty five RenderObject.format (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #forty six _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (bundle:flutter/src/rendering/proxy_box.dart:108:thirteen) I/flutter (12956): #forty seven RenderObject.structure (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #forty eight _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (bundle:flutter/src/rendering/proxy_box.dart:108:thirteen) I/flutter (12956): #forty nine RenderObject.format (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #50 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (bundle:flutter/src/rendering/proxy_box.dart:108:thirteen) I/flutter (12956): #fifty one RenderObject.structure (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #fifty two _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (bundle:flutter/src/rendering/proxy_box.dart:108:thirteen) I/flutter (12956): #fifty three RenderObject.format (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #fifty four _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (bundle:flutter/src/rendering/proxy_box.dart:108:thirteen) I/flutter (12956): #fifty five RenderOffstage.performLayout (bundle:flutter/src/rendering/proxy_box.dart:2884:thirteen) I/flutter (12956): #fifty six RenderObject.format (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #fifty seven RenderStack.performLayout (bundle:flutter/src/rendering/stack.dart:520:15) I/flutter (12956): #fifty eight RenderObject.format (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #fifty nine __RenderTheatre&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (bundle:flutter/src/rendering/proxy_box.dart:108:thirteen) I/flutter (12956): #60 RenderObject.format (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #sixty one _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (bundle:flutter/src/rendering/proxy_box.dart:108:thirteen) I/flutter (12956): #sixty two RenderObject.format (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #sixty three _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (bundle:flutter/src/rendering/proxy_box.dart:108:thirteen) I/flutter (12956): #sixty four RenderObject.structure (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #sixty five _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (bundle:flutter/src/rendering/proxy_box.dart:108:thirteen) I/flutter (12956): #sixty six RenderObject.structure (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #sixty seven _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (bundle:flutter/src/rendering/proxy_box.dart:108:thirteen) I/flutter (12956): #sixty eight RenderObject.format (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #sixty nine _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (bundle:flutter/src/rendering/proxy_box.dart:108:thirteen) I/flutter (12956): #70 RenderObject.structure (bundle:flutter/src/rendering/entity.dart:1631:7) I/flutter (12956): #seventy one RenderView.performLayout (bundle:flutter/src/rendering/position.dart:147:thirteen) I/flutter (12956): #seventy two RenderObject._layoutWithoutResize (bundle:flutter/src/rendering/entity.dart:1506:7) I/flutter (12956): #seventy three PipelineOwner.flushLayout (bundle:flutter/src/rendering/entity.dart:765:18) I/flutter (12956): #seventy four _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding.drawFrame (bundle:flutter/src/rendering/binding.dart:270:19) I/flutter (12956): #seventy five _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame (bundle:flutter/src/widgets/binding.dart:674:thirteen) I/flutter (12956): #seventy six _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback (bundle:flutter/src/rendering/binding.dart:208:5) I/flutter (12956): #seventy seven _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (bundle:flutter/src/scheduler/binding.dart:990:15) I/flutter (12956): #seventy eight _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (bundle:flutter/src/scheduler/binding.dart:930:9) I/flutter (12956): #seventy nine _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.scheduleWarmUpFrame.<nameless closure> (bundle:flutter/src/scheduler/binding.dart:751:7) I/flutter (12956): #eighty one _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19) I/flutter (12956): #eighty two _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5) I/flutter (12956): #eighty three _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12) I/flutter (12956): (elided 1 framework from bundle dart:async) I/flutter (12956): I/flutter (12956): The pursuing RenderObject was being processed once the objection was fired: I/flutter (12956): RenderViewport#925a8 Wants-Format Wants-Coat I/flutter (12956): creator: Viewport ← _ScrollableScope ← IgnorePointer-[GlobalKey#8e8f7] ← Semantics ← Listener ← I/flutter (12956): _GestureSemantics ← RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#67ae5] ← I/flutter (12956): _ScrollSemantics-[GlobalKey#17eb8] ← RepaintBoundary ← CustomPaint ← RepaintBoundary ← I/flutter (12956): NotificationListener<ScrollNotification> ← β‹― I/flutter (12956): parentData: <no> (tin usage measurement) I/flutter (12956): constraints: BoxConstraints(unconstrained) I/flutter (12956): measurement: Lacking I/flutter (12956): axisDirection: behind I/flutter (12956): crossAxisDirection: correct I/flutter (12956): offset: ScrollPositionWithSingleContext#c4917(offset: zero.zero, scope: null..null, viewport: null, I/flutter (12956): ScrollableState, AlwaysScrollableScrollPhysics -> ClampingScrollPhysics, IdleScrollActivity#2fecf, I/flutter (12956): ScrollDirection.idle) I/flutter (12956): anchor: zero.zero I/flutter (12956): This RenderObject had the pursuing descendants (exhibiting ahead to extent 5): I/flutter (12956): RenderSliverPadding#74d62 Wants-Structure Wants-Coat I/flutter (12956): RenderSliverList#5c56d Wants-Format Wants-Coat I/flutter (12956): ════════════════════════════════════════════════════════════════════════════════════════════════════ I/flutter (12956): Different objection was thrown: RenderBox was not laid retired: RenderViewport#925a8 Wants-Format Wants-Coat I/flutter (12956): Different objection was thrown: RenderBox was not laid retired: RenderViewport#925a8 Wants-Coat I/flutter (12956): Different objection was thrown: RenderBox was not laid retired: RenderIgnorePointer#8bbda relayoutBoundary=up11 Wants-Coat I/flutter (12956): Different objection was thrown: RenderBox was not laid retired: RenderSemanticsAnnotations#209b4 relayoutBoundary=up10 Wants-Coat I/flutter (12956): Different objection was thrown: RenderBox was not laid retired: RenderPointerListener#a9641 relayoutBoundary=up9 Wants-Coat I/flutter (12956): Different objection was thrown: RenderBox was not laid retired: RenderSemanticsGestureHandler#9f5b4 relayoutBoundary=up8 Wants-Coat I/flutter (12956): Different objection was thrown: RenderBox was not laid retired: _RenderScrollSemantics#47944 relayoutBoundary=up7 Wants-Coat I/flutter (12956): Different objection was thrown: RenderBox was not laid retired: RenderRepaintBoundary#e17a8 relayoutBoundary=up6 Wants-Coat I/flutter (12956): Different objection was thrown: RenderBox was not laid retired: RenderCustomPaint#a2328 relayoutBoundary=up5 Wants-Coat I/flutter (12956): Different objection was thrown: RenderBox was not laid retired: RenderRepaintBoundary#02607 relayoutBoundary=up4 Wants-Coat I/flutter (12956): Different objection was thrown: RenderBox was not laid retired: RenderFlex#79164 relayoutBoundary=up3 Wants-Coat I/flutter (12956): Different objection was thrown: 'bundle:flutter/src/rendering/shifted_box.dart': Failed assertion: formation 310 pos 12: 'kid.hasSize': is not actual. I/flutter (12956): Different objection was thrown: NoSuchMethodError: The methodology '<=' was known as connected null. 

This is the list_form.dart people:

import 'bundle:flutter/worldly.dart'; people ListForm extends StatefulWidget { @override ListFormState createState() => fresh ListFormState(); } people ListFormState extends Government<ListForm> { Database<Drawstring> merchandise = ["Test1", "Test2", "Test3"]; @override Widget physique(BuildContext discourse) { instrument fresh Instrumentality( kid: fresh Halfway( kid: fresh File( kids: <Widget>[ fresh Line( kids: <Widget>[ fresh ListView.builder( itemCount: merchandise.dimension, itemBuilder: (BuildContext ctxt, int scale) { instrument fresh Matter(merchandise[scale]); } ), fresh IconButton( icon: Icon(Icons.remove_circle), onPressed: () { }, ) ], mainAxisAlignment: MainAxisAlignment.spaceBetween, ), fresh TextField( ornament: fresh InputDecoration( hintText: "Prodotto" ), onSubmitted: (Drawstring str) { setState(() { merchandise.adhd(str); }); }, ), ] ) ) ); } } 

This is the app_base.dart people:

import 'bundle:flutter/worldly.dart'; import '../UI/list_form.dart'; people AppBase extends StatefulWidget { @override Government createState() => fresh AppBaseState(); } people AppBaseState extends Government<AppBase> { bool _pressed = actual; @override Widget physique(BuildContext discourse) { instrument fresh Worldly( colour: Colours.greenAccent, kid: fresh Scaffold( assemblage: fresh ListForm(), appBar: AppBar( centerTitle: actual, rubric: const Matter('Skeeper'), backgroundColor: Colours.greenish, ), floatingActionButton: FloatingActionButton( tooltip: 'Trial', kid: fresh Icon(Icons.adhd), backgroundColor: Colours.greenish, onPressed: () { setState(() { _pressed = !_pressed; }); }, ), ) ); } } 

Don’t concern if location is any unused codification, it’s a activity successful advancement and this mistake conscionable stopped maine persevering with what I was doing.

The job is that you are inserting the ListView wrong a File/Line. The matter successful the objection provides a bully mentation of the mistake.

To debar the mistake you demand to supply a dimension to the ListView wrong.

I suggest you this codification that makes use of an Expanded to communicate the horizontal dimension (most disposable) and the SizedBox (May beryllium a Instrumentality) for the tallness:

fresh Line( kids: <Widget>[ Expanded( kid: SizedBox( tallness: 200.zero, kid: fresh ListView.builder( scrollDirection: Axis.horizontal, itemCount: merchandise.dimension, itemBuilder: (BuildContext ctxt, int scale) { instrument fresh Matter(merchandise[scale]); }, ), ), ), fresh IconButton( icon: Icon(Icons.remove_circle), onPressed: () {}, ), ], mainAxisAlignment: MainAxisAlignment.spaceBetween, ) 

,