RenderPadding object was given an infinite size during layout - flutter

I was trying to have another widget in my flutter page so instead of having a container I used (column /list view )
this is the code (main things have red line )
enter image description here
now Im getting these errors
child: RenderPointerListener#c3ba4 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
parentData:
constraints: MISSING
size: MISSING
behavior: deferToChild
listeners: down
child: ChartContainerRenderObject#c7bf3 NEEDS-LAYOUT NEEDS-PAINT
parentData:
constraints: MISSING
semantic boundary
size: MISSING
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by rendering library ═════════════════════════════════
RenderPadding object was given an infinite size during layout.
The relevant error-causing widget was
SafeArea
lib\dept.dart:62
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by rendering library ═════════════════════════════════
A RenderFlex overflowed by Infinity pixels on the bottom.
The relevant error-causing widget was
Column
lib\dept.dart:60

the issue was solved by adding height:value to the container
child: ListView(
shrinkWrap: true,
children: [
Container(
height: 400,
child: SafeArea(.......)),
Container(child:new Text("palestine");))

This issue can be solved by adding Flexible to your widget.

Related

Flutter Exception caught Error but still works my app Why?

I am take this error and I dont know why ?
I am get this error messages but my app works flawlessly
Here the errors:
════════ Exception caught by widgets library ═══════════════════════════════════
The following assertion was thrown while applying parent data.:
Incorrect use of ParentDataWidget.
The ParentDataWidget Expanded(flex: 1) wants to apply ParentData of type FlexParentData to a RenderObject, which has been set up to accept ParentData of incompatible type ParentData.
Usually, this means that the Expanded widget has the wrong ancestor RenderObjectWidget. Typically, Expanded widgets are placed directly inside Flex widgets.
The offending Expanded is currently placed inside a RepaintBoundary widget.
The ownership chain for the RenderObject that received the incompatible parent data was:
Padding ← Expanded ← RepaintBoundary ← IndexedSemantics ← NotificationListener ← KeepAlive ← AutomaticKeepAlive ← KeyedSubtree ← SliverList ← MediaQuery ← ⋯
When the exception was thrown, this was the stack
(elided 11 frames from class _RawReceivePortImpl, class _Timer, dart:async, and dart:async-patch)
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by widgets library ═══════════════════════════════════
Incorrect use of ParentDataWidget.
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by widgets library ═══════════════════════════════════
Incorrect use of ParentDataWidget.
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by widgets library ═══════════════════════════════════
Incorrect use of ParentDataWidget.
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by widgets library ═══════════════════════════════════
Incorrect use of ParentDataWidget.
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by widgets library ═══════════════════════════════════
Incorrect use of ParentDataWidget.
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by widgets library ═══════════════════════════════════
Incorrect use of ParentDataWidget.
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by widgets library ═══════════════════════════════════
Incorrect use of ParentDataWidget.
════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by widgets library ═══════════════════════════════════
Incorrect use of ParentDataWidget.
════════════════════════════════════════════════════════════════════════════════
and here my codes
Widget build(BuildContext context) {
return Scaffold(
body: ListView(
controller: listScrollController,
children: [
Padding(
padding: context.paddingLeft + context.paddingTop,
child: Text(
Texts.headerText,
style: context.theme.textTheme.headline3!.copyWith(),
),
),
Expanded(
child: Padding(
padding: context.paddingAll,
child: SizedBox(
height: context.dynamicHeight(0.4),
child: Lottie.asset(Assets.asset1)),
),
),
Expanded(
child: Padding(
padding: context.paddingLeft,
child: Text(
Texts.viewText,
style: context.theme.textTheme.titleLarge,
),
),
),
Expanded(
child: Padding(
padding: context.paddingTop,
child: downButton(
() {
scrollToBottom();
},
),
),
),
Stack(
children: [
SizedBox(
height: context.dynamicHeight(2),
child: Padding(
padding: context.paddingTop * 2,
child: Lottie.asset(Assets.asset2, fit: BoxFit.cover),
),
),
],
),
],
),
);
Thank you :)
You can only use Expandedor Flexible for Row and Column Widget. Other than that, it will give you error of incorrect parent widget.
The error it self indicates incorrect use of parent widget meaning that the Parent widget is incorrect which is true in case of ListView being the parent(wrong) of Expanded.
Expanded only used for Row or Column.
you can't use it as children for other widget.
Remove all Expanded widget from ListView children.
or change ListView to Column, and wrap it with singleChildscrollView to make it scrollable
You do not have a Flex ancestor and the issue will cause in release mode.
An Expanded widget must be a descendant of a Row, Column, or Flex, and the path from the Expanded widget to its enclosing Row, Column, or Flex must contain only StatelessWidgets or StatefulWidgets (not other kinds of widgets, like RenderObjectWidgets).
you can refer to this link
https://api.flutter.dev/flutter/widgets/Expanded-class.html#:~:text=A%20widget%20that%20expands%20a,or%20vertically%20for%20a%20Column).
In your case writing down Colum instead of listview will solve your issue. or remove expanded from listview

FutureBuilder not working inside ListView

i have FutureBuilder and ListView I want to show the bottom of some was one page after downloading JSON they appear as one piece.
I added FutureBuilder inside ListView
can't appear FutureBuilder and i have error in console
======== Exception caught by rendering library =====================================================
The following assertion was thrown during paint():
RenderBox was not laid out: RenderRepaintBoundary#e0a8a relayoutBoundary=up16 NEEDS-PAINT
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1930 pos 12: 'hasSize'
Add shrinkwrap and physics under ListView.builder
ListView.builder(
shrinkWrap: true,
physics: ScrollPhysics(),
itemCount: rodios.length,
)
Make sure the ListView is in a container that has sizes:
Container(width: double.infinity, height: double.infinity, child: ListView...)

How can I use a CustomScrollView as a child

I'm a newbie who just started Flutter.
I want to use CustomScrollView as a child of Row/Column Widget
It works very well when CustomScrollView is root.
But as soon as I put it into Row Widget's child, it spouted an error.
Couldn't CustomScrollview be used as a child of Row widget?
if so, please tell me the reason, and What is the best alternative?
Or if there is an error in my code, I want you to correct it.
What I want to make
my CustomScrollViewWidget
I don't know if this is what you want, but here's my error.
══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
The following assertion was thrown during performLayout():
'package:flutter/src/rendering/viewport.dart': Failed assertion: line 1758 pos 16:
'constraints.hasBoundedHeight': is not true.
Either the assertion indicates an error in the framework itself, or we should provide substantially
more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=BUG.md
The relevant error-causing widget was:
CustomScrollView
The following RenderObject was being processed when the exception was fired: RenderShrinkWrappingViewport#0344f relayoutBoundary=up14 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE:
needs compositing
creator: ShrinkWrappingViewport ← IgnorePointer-[GlobalKey#e4530] ← Semantics ← _PointerListener ←
Listener ← _GestureSemantics ←
RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#a61b3] ← _PointerListener ← Listener
← _ScrollableScope ← _ScrollSemantics-[GlobalKey#42b3c] ← RepaintBoundary ← ⋯
parentData: <none> (can use size)
constraints: BoxConstraints(unconstrained)
size: MISSING
axisDirection: right
crossAxisDirection: down
offset: ScrollPositionWithSingleContext#46fe1(offset: 0.0, range: null..null, viewport: null,
ScrollableState, ClampingScrollPhysics -> RangeMaintainingScrollPhysics, IdleScrollActivity#66c28,
ScrollDirection.idle)
This RenderObject had the following child:
child 0: RenderSliverList#42dfb NEEDS-LAYOUT NEEDS-PAINT
════════════════════════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderShrinkWrappingViewport#0344f relayoutBoundary=up14 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1702 pos 12: 'hasSize'
The relevant error-causing widget was
CustomScrollView
lib\0. TestCode.dart:31
════════════════════════════════════════════════════════════════════════════════
Here is my code!
class WrapVisit extends StatefulWidget {
WrapVisitState createState() => WrapVisitState();
}
class WrapVisitState extends State<WrapVisit> {
#override
Widget build(BuildContext context) {
return new Container(
padding: EdgeInsets.all(10),
color: Colors.white,
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
new Text(
"브랜드관",
textAlign: TextAlign.left,
style: TextStyle(fontWeight: FontWeight.bold),
),
new Container(
margin: EdgeInsets.all(5),
child: new Text(
"전체보기",
textAlign: TextAlign.right,
style: TextStyle(
fontSize: 10,
color: Colors.black,
),
),
),
CustomScrollView(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
slivers: [
SliverList(
delegate: SliverChildListDelegate(
[
... SliverListChildWidgets ...
],
),
),
],
),
],
),
],
),
);
}
}
Column doesn't like children with unbounded height. To fix it, set CustomScrollView's shrinkWrap parameter to true.
You need to wrap the scroll view in either a sized box or container first. It needs a parent with set dimensions. There’s a couple widgets that don’t work in rows/columns unless you put them inside a sized parent first.

Flutter: getting ListView in animated, positioned container being part of a stack

Maybe one of you already came across these problems. I spent numerous hours with trying to get the ListView (I also tried ExpansionPanelList) into a container that pans from the right edge into the screen (help menu) over the existing widgets. I have already created a mock-up starting with a basic ListView and then added feature by feature again. But now I am stuck and the error message is not of much help (to me).
Those exceptions are thrown as soon as I add the AnimatedPositioned. The main message seems to be an issue with constraints.hasBoundedWidth': is not true.
════════ Exception caught by rendering library ═════════════════════════════════════════════════════
The following assertion was thrown during performLayout():
'package:flutter/src/rendering/viewport.dart': Failed assertion: line 1754 pos 16: 'constraints.hasBoundedWidth': is not true.
Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=BUG.md
The relevant error-causing widget was:
ListView file:///Users/holger/IdeaProjects/math/lib/tmp.dart:496:40
When the exception was thrown, this was the stack:
#2 RenderShrinkWrappingViewport.performLayout (package:flutter/src/rendering/viewport.dart:1754:16)
#3 RenderObject.layout (package:flutter/src/rendering/object.dart:1775:7)
#4 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
#5 RenderObject.layout (package:flutter/src/rendering/object.dart:1775:7)
#6 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:115:13)
...
The following RenderObject was being processed when the exception was fired: RenderShrinkWrappingViewport#a1875 relayoutBoundary=up7 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(0.0<=w<=Infinity, 0.0<=h<=716.8)
... size: MISSING
... axisDirection: down
... crossAxisDirection: right
... offset: ScrollPositionWithSingleContext#20c01(offset: 0.0, range: null..null, viewport: null, ScrollableState, AlwaysScrollableScrollPhysics -> BouncingScrollPhysics, IdleScrollActivity#3e990, ScrollDirection.idle)
RenderObject: RenderShrinkWrappingViewport#a1875 relayoutBoundary=up7 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
needs compositing
parentData: <none> (can use size)
constraints: BoxConstraints(0.0<=w<=Infinity, 0.0<=h<=716.8)
size: MISSING
axisDirection: down
crossAxisDirection: right
offset: ScrollPositionWithSingleContext#20c01(offset: 0.0, range: null..null, viewport: null, ScrollableState, AlwaysScrollableScrollPhysics -> BouncingScrollPhysics, IdleScrollActivity#3e990, ScrollDirection.idle)
... child 0: RenderSliverPadding#078d5 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: layoutOffset=None
... constraints: MISSING
... geometry: null
... padding: EdgeInsets.zero
... textDirection: ltr
... child: RenderSliverList#fd0a6 NEEDS-LAYOUT NEEDS-PAINT
... parentData: paintOffset=Offset(0.0, 0.0)
... constraints: MISSING
... geometry: null
... no children current live
════════════════════════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by rendering library ═════════════════════════════════════════════════════
RenderBox was not laid out: RenderShrinkWrappingViewport#a1875 relayoutBoundary=up7 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1713 pos 12: 'hasSize'
The relevant error-causing widget was:
ListView file:///Users/holger/IdeaProjects/math/lib/tmp.dart:496:40
The lower part of the exception message is repeated multiple times, maybe once for every animation step. Then the messages finish with those below, where the reference container is the one of AnimatedPositiones > IgnorePointer > Container
════════ Exception caught by rendering library ═════════════════════════════════════════════════════
The following assertion was thrown during paint():
RenderBox was not laid out: RenderDecoratedBox#a83d8
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1713 pos 12: 'hasSize'
Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=BUG.md
The relevant error-causing widget was:
Container file:///Users/holger/IdeaProjects/math/lib/tmp3.dart:474:32
When the exception was thrown, this was the stack:
#2 RenderBox.size (package:flutter/src/rendering/box.dart:1713:12)
#3 RenderDecoratedBox.paint (package:flutter/src/rendering/proxy_box.dart:2067:12)
#4 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2307:7)
#5 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:191:13)
#6 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:133:15)
...
The following RenderObject was being processed when the exception was fired: RenderDecoratedBox#a83d8
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=331.2, h=716.8)
... size: MISSING
... decoration: BoxDecoration
... color: Color(0xffffffff)
... configuration: ImageConfiguration(bundle: PlatformAssetBundle#b6597(), devicePixelRatio: 3.0, locale: en_US, textDirection: TextDirection.ltr, platform: iOS)
RenderObject: RenderDecoratedBox#a83d8
needs compositing
parentData: <none> (can use size)
constraints: BoxConstraints(w=331.2, h=716.8)
size: MISSING
decoration: BoxDecoration
color: Color(0xffffffff)
configuration: ImageConfiguration(bundle: PlatformAssetBundle#b6597(), devicePixelRatio: 3.0, locale: en_US, textDirection: TextDirection.ltr, platform: iOS)
... child: RenderFlex#28045 NEEDS-PAINT
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=331.2, h=716.8)
... size: MISSING
... direction: horizontal
... mainAxisAlignment: start
... mainAxisSize: max
... crossAxisAlignment: center
... textDirection: ltr
... verticalDirection: down
... textBaseline: alphabetic
... child 1: RenderPadding#b537d relayoutBoundary=up1 NEEDS-PAINT
... parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
... constraints: BoxConstraints(0.0<=w<=Infinity, 0.0<=h<=716.8)
... size: Size(59.0, 716.8)
... padding: EdgeInsets(3.0, 0.0, 0.0, 0.0)
... textDirection: ltr
... child: RenderFlex#4c2a2 relayoutBoundary=up2 NEEDS-PAINT
... parentData: offset=Offset(3.0, 0.0) (can use size)
... constraints: BoxConstraints(0.0<=w<=Infinity, 0.0<=h<=716.8)
... size: Size(56.0, 716.8)
... direction: vertical
... mainAxisAlignment: spaceEvenly
... mainAxisSize: max
... crossAxisAlignment: center
... verticalDirection: down
... child 1: RenderSemanticsGestureHandler#c07e2 relayoutBoundary=up3 NEEDS-PAINT
... parentData: offset=Offset(0.0, 330.4); flex=null; fit=null (can use size)
... constraints: BoxConstraints(unconstrained)
... size: Size(56.0, 56.0)
... gestures: tap
... child 2: _RenderScrollSemantics#80100 relayoutBoundary=up1 NEEDS-PAINT
... needs compositing
... parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
... constraints: BoxConstraints(0.0<=w<=Infinity, 0.0<=h<=716.8)
... semantic boundary
... size: MISSING
... child: RenderPointerListener#695c7 relayoutBoundary=up2 NEEDS-PAINT
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(0.0<=w<=Infinity, 0.0<=h<=716.8)
... size: MISSING
... behavior: deferToChild
... listeners: signal
... child: RenderSemanticsGestureHandler#db442 relayoutBoundary=up3 NEEDS-PAINT
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(0.0<=w<=Infinity, 0.0<=h<=716.8)
... size: MISSING
... gestures: <none>
════════════════════════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by rendering library ═════════════════════════════════════════════════════
RenderBox was not laid out: RenderDecoratedBox#a83d8
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1713 pos 12: 'hasSize'
The relevant error-causing widget was:
Container file:///Users/holger/IdeaProjects/math/lib/tmp3.dart:474:32
The ListView looks like this, it shows headers of different tags and each can be expanded to show detail information.
AnimatedPositioned(duration: Duration(milliseconds: 800),
left: _drawerLeft,
top:5,
child: IgnorePointer(ignoring: (_drawerLeft <= MediaQuery.of(context).size.width / 3 ? false:true),
child: Container(
height:0.8*1 * MediaQuery.of(context).size.height, width:0.8 * MediaQuery.of(context).size.width,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
CupertinoButton(
child: Icon(fwdBtn),
onPressed: () {
setState(() {
_drawerLeft = 1 * MediaQuery.of(context).size.width;
controller.reverse();
});
},
),
ListView.builder(
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: usedTagData.length, itemBuilder: (BuildContext context, int index) {
return Column(
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(usedTagData[index].header, style: TextStyle(color: CupertinoColors.link)),
CupertinoButton(
child: Icon(dwnBtn),
onPressed: () {
setState(() {
usedTagData[index].isExpanded = !usedTagData[index].isExpanded;
});
},
),
],
),
(usedTagData[index].isExpanded ?
Text(usedTagData[index].content)
:
Container()
),
]
);
}
),
],
),
)),
)
The AnimatedPositioned is a widget of
return Container(
height: MediaQuery.of(context).size.height,
child: Stack(
fit: StackFit.expand,
children: <Widget>[
Do you have any idea how to go forward on this or do the exception messages provide any hint to you?
The only way you would get ListView to work with Row is to set a predefined width. Your ListView tries to expand infinitely so you should constrain it by setting a predefined width.
Here is an example:
Row(
children:[
SizedBox(
width:200,
child:ListView()
),
]),

Expanded Listview inside a Column in Flutter

I'm new to Flutter and I've been stuck here for a while now. I am trying to make a main screen in Flutter for web, but I keep getting this error every time I try to apply the expanded property to the listview widget.
This is the code, the error, and what I'm trying to get:
[What I'm trying to do]:
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:hotelmanager/optionsList.dart';
class MainScreen extends StatefulWidget {
#override
State<StatefulWidget> createState() {
return _MainScreenState();
}
}
class _MainScreenState extends State<MainScreen> {
#override
void initState() {
super.initState();
}
#override
Widget build(BuildContext context) {
return Center(
child: Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
alignment: Alignment.center,
color: Colors.white,
child: Column(
children: <Widget>[
/*LEFT SIDE MENU*/
Expanded(
flex: 2,
child: Column(
children: <Widget>[
ListView(
children: <Widget>[
Container(
color: Colors.red,
child: Text("RED"),
)
],
),
],
),
),
/*HORIZONTAL AND CENTRAL MENU*/
Expanded(
flex: 8,
child: Column(
children: <Widget>[
/*HORIZONTAL MENU-ROW*/
Expanded(
flex: 2,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
ListView(
children: <Widget>[
Container(
color: Colors.indigoAccent,
child: Text("BLUE"),
)
],
),
],
),
),
/*MAIN MENU-ROW*/
Expanded(
flex: 8,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
color: Colors.green,
child: Text("GREEN"),
),
],
),
)
],
),
)
],
),
));
}
}
The error log:
Launching lib\main.dart on Chrome in debug mode...
Syncing files to device Chrome...
Debug service listening on ws://127.0.0.1:62280/NmOsZXmtIqE=
Debug service listening on ws://127.0.0.1:62280/NmOsZXmtIqE=
══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
The following assertion was thrown during performLayout():
RenderFlex children have non-zero flex but incoming height constraints are unbounded.
When a column is in a parent that does not provide a finite height constraint, for example if it is
in a vertical scrollable, it will try to shrink-wrap its children along the vertical axis. Setting a
flex on a child (e.g. using Expanded) indicates that the child is to expand to fill the remaining
space in the vertical direction.
These two directives are mutually exclusive. If a parent is to shrink-wrap its child, the child
cannot simultaneously expand to fit its parent.
Consider setting mainAxisSize to MainAxisSize.min and using FlexFit.loose fits for the flexible
children (using Flexible rather than Expanded). This will allow the flexible children to size
themselves to less than the infinite remaining space they would otherwise be forced to take, and
then will cause the RenderFlex to shrink-wrap the children rather than expanding to fit the maximum
constraints provided by the parent.
If this message did not help you determine the problem, consider using debugDumpRenderTree():
https://flutter.dev/debugging/#rendering-layer
http://api.flutter.dev/flutter/rendering/debugDumpRenderTree.html
The affected RenderFlex is:
RenderFlex#f5e21 relayoutBoundary=up2 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE(creator: Column ← Column ← Align ← ConstrainedBox ← Container ← Center ← MainScreen ← _BodyBuilder ← MediaQuery ← LayoutId-[<_ScaffoldSlot.body>] ← CustomMultiChildLayout ← AnimatedBuilder ← ⋯, parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size), constraints: BoxConstraints(0.0<=w<=929.0, 0.0<=h<=Infinity), size: MISSING, direction: vertical, mainAxisAlignment: start, mainAxisSize: max, crossAxisAlignment: center, verticalDirection: down)
The creator information is set to:
Column ← Column ← Align ← ConstrainedBox ← Container ← Center ← MainScreen ← _BodyBuilder ←
MediaQuery ← LayoutId-[<_ScaffoldSlot.body>] ← CustomMultiChildLayout ← AnimatedBuilder ← ⋯
The nearest ancestor providing an unbounded width constraint is: RenderFlex#62f2b relayoutBoundary=up1 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE:
creator: Column ← Align ← ConstrainedBox ← Container ← Center ← MainScreen ← _BodyBuilder ←
MediaQuery ← LayoutId-[<_ScaffoldSlot.body>] ← CustomMultiChildLayout ← AnimatedBuilder ←
DefaultTextStyle ← ⋯
parentData: offset=Offset(0.0, 0.0) (can use size)
constraints: BoxConstraints(0.0<=w<=929.0, 0.0<=h<=876.0)
size: MISSING
direction: vertical
mainAxisAlignment: start
mainAxisSize: max
crossAxisAlignment: center
verticalDirection: down
See also: https://flutter.dev/layout/
If none of the above helps enough to fix this problem, please don't hesitate to file a bug:
https://github.com/flutter/flutter/issues/new?template=BUG.md
The relevant error-causing widget was:
Column file:///C:/Users/Jorge%20Antelo/Desktop/Flutter/hotelmanager/lib/mainContainer.dart:46:13
When the exception was thrown, this was the stack:
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 196:49 throw_
package:flutter/src/rendering/flex.dart 693:11 <fn>
package:flutter/src/rendering/flex.dart 717:15 performLayout
package:flutter/src/rendering/object.dart 1767:7 layout
package:flutter/src/rendering/flex.dart 746:14 performLayout
package:flutter/src/rendering/object.dart 1767:7 layout
package:flutter/src/rendering/shifted_box.dart 394:13 performLayout
package:flutter/src/rendering/object.dart 1767:7 layout
package:flutter/src/rendering/proxy_box.dart 265:13 performLayout
package:flutter/src/rendering/object.dart 1767:7 layout
package:flutter/src/rendering/shifted_box.dart 394:13 performLayout
package:flutter/src/rendering/object.dart 1767:7 layout
package:flutter/src/rendering/custom_layout.dart 171:10 layoutChild
package:flutter/src/material/scaffold.dart 484:7 performLayout
package:flutter/src/rendering/custom_layout.dart 240:7 [_callPerformLayout]
package:flutter/src/rendering/custom_layout.dart 399:14 performLayout
package:flutter/src/rendering/object.dart 1767:7 layout
package:flutter/src/rendering/proxy_box.dart 110:13 performLayout
package:flutter/src/rendering/object.dart 1767:7 layout
package:flutter/src/rendering/proxy_box.dart 110:13 performLayout
package:flutter/src/rendering/proxy_box.dart 1247:11 performLayout
package:flutter/src/rendering/object.dart 1767:7 layout
package:flutter/src/rendering/proxy_box.dart 110:13 performLayout
package:flutter/src/rendering/object.dart 1767:7 layout
package:flutter/src/rendering/proxy_box.dart 110:13 performLayout
package:flutter/src/rendering/object.dart 1767:7 layout
package:flutter/src/rendering/proxy_box.dart 110:13 performLayout
package:flutter/src/rendering/object.dart 1767:7 layout
package:flutter/src/rendering/proxy_box.dart 110:13 performLayout
package:flutter/src/rendering/object.dart 1767:7 layout
package:flutter/src/rendering/proxy_box.dart 110:13 performLayout
package:flutter/src/rendering/object.dart 1767:7 layout
package:flutter/src/rendering/proxy_box.dart 110:13 performLayout
package:flutter/src/rendering/object.dart 1767:7 layout
package:flutter/src/rendering/proxy_box.dart 110:13 performLayout
package:flutter/src/rendering/object.dart 1767:7 layout
package:flutter/src/rendering/proxy_box.dart 110:13 performLayout
package:flutter/src/rendering/proxy_box.dart 3224:13 performLayout
package:flutter/src/rendering/object.dart 1767:7 layout
package:flutter/src/widgets/overlay.dart 700:14 performLayout
package:flutter/src/rendering/object.dart 1767:7 layout
package:flutter/src/rendering/proxy_box.dart 110:13 performLayout
package:flutter/src/rendering/object.dart 1767:7 layout
package:flutter/src/rendering/proxy_box.dart 110:13 performLayout
package:flutter/src/rendering/object.dart 1767:7 layout
package:flutter/src/rendering/proxy_box.dart 110:13 performLayout
package:flutter/src/rendering/object.dart 1767:7 layout
package:flutter/src/rendering/proxy_box.dart 110:13 performLayout
package:flutter/src/rendering/object.dart 1767:7 layout
package:flutter/src/rendering/proxy_box.dart 110:13 performLayout
package:flutter/src/rendering/object.dart 1767:7 layout
package:flutter/src/rendering/proxy_box.dart 110:13 performLayout
package:flutter/src/rendering/object.dart 1767:7 layout
package:flutter/src/rendering/view.dart 167:48 performLayout
package:flutter/src/rendering/object.dart 1630:7 [_layoutWithoutResize]
package:flutter/src/rendering/object.dart 887:17 flushLayout
package:flutter/src/rendering/binding.dart 401:19 drawFrame
package:flutter/src/widgets/binding.dart 884:13 drawFrame
package:flutter/src/rendering/binding.dart 283:5 [_handlePersistentFrameCallback]
package:flutter/src/scheduler/binding.dart 1108:15 [_invokeFrameCallback]
package:flutter/src/scheduler/binding.dart 1047:9 handleDrawFrame
package:flutter/src/scheduler/binding.dart 856:7 <fn>
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/isolate_helper.dart 50:19 internalCallback
The following RenderObject was being processed when the exception was fired: RenderFlex#f5e21 relayoutBoundary=up2 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE:
creator: Column ← Column ← Align ← ConstrainedBox ← Container ← Center ← MainScreen ← _BodyBuilder ←
MediaQuery ← LayoutId-[<_ScaffoldSlot.body>] ← CustomMultiChildLayout ← AnimatedBuilder ← ⋯
parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
constraints: BoxConstraints(0.0<=w<=929.0, 0.0<=h<=Infinity)
size: MISSING
direction: vertical
mainAxisAlignment: start
mainAxisSize: max
crossAxisAlignment: center
verticalDirection: down
This RenderObject had the following descendants (showing up to depth 5):
child 1: RenderFlex#9da6e NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
child 1: RenderRepaintBoundary#b779b NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
child: RenderCustomPaint#67333 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
child: RenderRepaintBoundary#89099 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
child: _RenderScrollSemantics#0b273 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
child 2: RenderFlex#fb6ad NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
child 1: _RenderColoredBox#0acb4 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
child: RenderParagraph#61e06 NEEDS-LAYOUT NEEDS-PAINT
text: TextSpan
════════════════════════════════════════════════════════════════════════════════════════════════════
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1694:12
Another exception was thrown: Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/shifted_box.dart:322:12
Another exception was thrown: NoSuchMethodError: '<Unexpected Null Value>'
════════ Exception caught by rendering library ═════════════════════════════════════════════════════
The following NoSuchMethodError was thrown during paint():
'<Unexpected Null Value>'
method not found
Receiver: null
Arguments: []
The relevant error-causing widget was:
Column file:///C:/Users/Jorge%20Antelo/Desktop/Flutter/hotelmanager/lib/mainContainer.dart:25:16
When the exception was thrown, this was the stack:
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 196:49 throw_
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 37:3 throwNullValueError
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 450:39 _notNull
package:flutter/src/rendering/flex.dart 475:38 get [_hasOverflow]
package:flutter/src/rendering/flex.dart 949:10 paint
...
The following RenderObject was being processed when the exception was fired: RenderFlex#62f2b relayoutBoundary=up1
... needs compositing
... parentData: offset=Offset(0.0, 0.0) (can use size)
... constraints: BoxConstraints(0.0<=w<=929.0, 0.0<=h<=876.0)
... size: MISSING
... direction: vertical
... mainAxisAlignment: start
... mainAxisSize: max
... crossAxisAlignment: center
... verticalDirection: down
RenderObject: RenderFlex#62f2b relayoutBoundary=up1
needs compositing
parentData: offset=Offset(0.0, 0.0) (can use size)
constraints: BoxConstraints(0.0<=w<=929.0, 0.0<=h<=876.0)
size: MISSING
direction: vertical
mainAxisAlignment: start
mainAxisSize: max
crossAxisAlignment: center
verticalDirection: down
... child 1: RenderFlex#6be7a NEEDS-LAYOUT NEEDS-PAINT
... needs compositing
... parentData: offset=Offset(0.0, 0.0); flex=1; fit=FlexFit.tight
... constraints: MISSING
... size: MISSING
... direction: vertical
... mainAxisAlignment: start
... mainAxisSize: max
... crossAxisAlignment: center
... verticalDirection: down
... child 1: RenderRepaintBoundary#15c70 NEEDS-LAYOUT NEEDS-PAINT
... needs compositing
... parentData: offset=Offset(0.0, 0.0); flex=null; fit=null
... constraints: MISSING
... size: MISSING
... usefulness ratio: no metrics collected yet (never painted)
... child: RenderCustomPaint#79694 NEEDS-LAYOUT NEEDS-PAINT
... needs compositing
... parentData: <none>
... constraints: MISSING
... size: MISSING
... child: RenderRepaintBoundary#81e95 NEEDS-LAYOUT NEEDS-PAINT
... needs compositing
... parentData: <none>
... constraints: MISSING
... size: MISSING
... usefulness ratio: no metrics collected yet (never painted)
... child 2: RenderFlex#f5e21 relayoutBoundary=up2 NEEDS-PAINT
... needs compositing
... parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
... constraints: BoxConstraints(0.0<=w<=929.0, 0.0<=h<=Infinity)
... size: MISSING
... direction: vertical
... mainAxisAlignment: start
... mainAxisSize: max
... crossAxisAlignment: center
... verticalDirection: down
... child 1: RenderFlex#9da6e NEEDS-LAYOUT NEEDS-PAINT
... needs compositing
... parentData: offset=Offset(0.0, 0.0); flex=1; fit=FlexFit.tight
... constraints: MISSING
... size: MISSING
... direction: horizontal
... mainAxisAlignment: spaceEvenly
... mainAxisSize: max
... crossAxisAlignment: center
... textDirection: ltr
... verticalDirection: down
... child 1: RenderRepaintBoundary#b779b NEEDS-LAYOUT NEEDS-PAINT
... needs compositing
... parentData: offset=Offset(0.0, 0.0); flex=null; fit=null
... constraints: MISSING
... size: MISSING
... usefulness ratio: no metrics collected yet (never painted)
... child: RenderCustomPaint#67333 NEEDS-LAYOUT NEEDS-PAINT
... needs compositing
... parentData: <none>
... constraints: MISSING
... size: MISSING
... child 2: RenderFlex#fb6ad NEEDS-LAYOUT NEEDS-PAINT
... parentData: offset=Offset(0.0, 0.0); flex=1; fit=FlexFit.tight
... constraints: MISSING
... size: MISSING
... direction: horizontal
... mainAxisAlignment: spaceEvenly
... mainAxisSize: max
... crossAxisAlignment: center
... textDirection: ltr
... verticalDirection: down
... child 1: _RenderColoredBox#0acb4 NEEDS-LAYOUT NEEDS-PAINT
... parentData: offset=Offset(0.0, 0.0); flex=null; fit=null
... constraints: MISSING
... size: MISSING
... behavior: opaque
... child: RenderParagraph#61e06 NEEDS-LAYOUT NEEDS-PAINT
... parentData: <none>
... constraints: MISSING
... size: MISSING
... textAlign: start
... textDirection: ltr
... softWrap: wrapping at box width
... overflow: clip
... locale: en_US
... maxLines: unlimited
════════════════════════════════════════════════════════════════════════════════════════════════════
════════ (2) Exception caught by rendering library ═════════════════════════════════════════════════
RenderFlex children have non-zero flex but incoming height constraints are unbounded.
The relevant error-causing widget was:
Column file:///C:/Users/Jorge%20Antelo/Desktop/Flutter/hotelmanager/lib/mainContainer.dart:46:13
════════════════════════════════════════════════════════════════════════════════════════════════════
════════ (3) Exception caught by rendering library ═════════════════════════════════════════════════
Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1694:12
hasSize
"RenderBox was not laid out: RenderFlex#f5e21 relayoutBoundary=up2 NEEDS-PAINT"
The relevant error-causing widget was:
Column file:///C:/Users/Jorge%20Antelo/Desktop/Flutter/hotelmanager/lib/mainContainer.dart:25:16
════════════════════════════════════════════════════════════════════════════════════════════════════
════════ (4) Exception caught by rendering library ═════════════════════════════════════════════════
Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/shifted_box.dart:322:12
child.hasSize
is not true
The relevant error-causing widget was:
Container file:///C:/Users/Jorge%20Antelo/Desktop/Flutter/hotelmanager/lib/mainContainer.dart:21:14
════════════════════════════════════════════════════════════════════════════════════════════════════
════════ (5) Exception caught by rendering library ═════════════════════════════════════════════════
'<Unexpected Null Value>'
method not found
Receiver: null
Arguments: []
The relevant error-causing widget was:
Column file:///C:/Users/Jorge%20Antelo/Desktop/Flutter/hotelmanager/lib/mainContainer.dart:25:16
════════════════════════════════════════════════════════════════════════════════════════════════════
════════ (6) Exception caught by rendering library ═════════════════════════════════════════════════
Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/box.dart:1694:12
hasSize
"RenderBox was not laid out: RenderFlex#f5e21 relayoutBoundary=up2 NEEDS-PAINT"
The relevant error-causing widget was:
Column file:///C:/Users/Jorge%20Antelo/Desktop/Flutter/hotelmanager/lib/mainContainer.dart:25:16
════════════════════════════════════════════════════════════════════════════════════════════════════
════════ (7) Exception caught by rendering library ═════════════════════════════════════════════════
Assertion failed: file:///C:/flutter/packages/flutter/lib/src/rendering/shifted_box.dart:322:12
child.hasSize
is not true
The relevant error-causing widget was:
Container file:///C:/Users/Jorge%20Antelo/Desktop/Flutter/hotelmanager/lib/mainContainer.dart:21:14
════════════════════════════════════════════════════════════════════════════════════════════════════
════════ (8) Exception caught by rendering library ═════════════════════════════════════════════════
'<Unexpected Null Value>'
method not found
Receiver: null
Arguments: []
The relevant error-causing widget was:
Column file:///C:/Users/Jorge%20Antelo/Desktop/Flutter/hotelmanager/lib/mainContainer.dart:25:16
════════════════════════════════════════════════════════════════════════════════════════════════════
════════ (9) Exception caught by rendering library ═════════════════════════════════════════════════
'<Unexpected Null Value>'
method not found
Receiver: null
Arguments: []
The relevant error-causing widget was:
Column file:///C:/Users/Jorge%20Antelo/Desktop/Flutter/hotelmanager/lib/mainContainer.dart:25:16
════════════════════════════════════════════════════════════════════════════════════════════════════
════════ (10) Exception caught by rendering library ════════════════════════════════════════════════
'<Unexpected Null Value>'
method not found
Receiver: null
Arguments: []
The relevant error-causing widget was:
Column file:///C:/Users/Jorge%20Antelo/Desktop/Flutter/hotelmanager/lib/mainContainer.dart:25:16
════════════════════════════════════════════════════════════════════════════════════════════════════
Application finished.
The error occurs because you are trying to expand without constrains. Expanded Widget is used with a parent with dimension constrains. Since you are using it directly as one of the children in a column it can't infer which dismission to take.
By default Expanded expand to fill dimension of the parent so you have to provide a parent like a container or padding or sizeBoxed
Edit:
You will also need some flex widgets ( Flexible) to achieve the layout.
follow this link to see a sample I made in dartpad.
return Column(
children: <Widget>[
Flexible(
flex: 1,
child: Row(children: <Widget>[
Expanded(
child: Container(
height: 150,
color: Colors.black,
child: RaisedButton(onPressed: null)))
])),
Flexible(
flex: 6,
child: Row(
children: <Widget>[
Flexible(
flex: 1,
child: Column(children: <Widget>[
Expanded(
child: Container(
width: 200,
color: Colors.white,
child: RaisedButton(onPressed: null)))
])),
Flexible(
flex: 3,
child: Column(
children: <Widget>[
Flexible(
flex: 1,
child: Row(children: <Widget>[
Expanded(
child: Container(
height: height,
color: Colors.red,
child: RaisedButton(onPressed: null)))
])),
Flexible(
flex: 10,
child: Row(children: <Widget>[
Expanded(
child: Container(
height: height,
color: Colors.green,
child: RaisedButton(
onPressed: null,
)))
])),
],
),
),
],
),
),
],
);