Closed jadekang0611 closed 3 years ago
Check Your Rows ANd Column Widgets. If any row or widget has a single flexible child. an error will occur
All Possible working solution added [Solved] RenderFlex children have non-zero flex but incoming height constraints are unbounded
Describe the bug Hi @mitesh77, thank you for the beautiful UI templates. Looks like everything went well but when I included the getPopularCourseUI() in line 34 in the home.dart file it give the following error which I think is caused by popular_job_list_view file.
RenderFlex children have non-zero flex but incoming height constraints are unbounded.
Here is the error I get:
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#90c65 relayoutBoundary=up12 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE needs compositing parentData: (can use size)
constraints: BoxConstraints(0.0<=w<=411.4, 0.0<=h<=Infinity)
size: Size(411.4, 342.0)
direction: vertical
mainAxisAlignment: start
mainAxisSize: max
crossAxisAlignment: center
verticalDirection: down
... child 1: RenderPadding#9bcad relayoutBoundary=up13 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
... constraints: BoxConstraints(0.0<=w<=411.4, 0.0<=h<=Infinity)
... size: Size(411.4, 72.0)
... padding: EdgeInsets(18.0, 8.0, 0.0, 0.0)
... textDirection: ltr
... child: RenderFlex#b0df9 relayoutBoundary=up14 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: offset=Offset(18.0, 8.0) (can use size)
... constraints: BoxConstraints(0.0<=w<=393.4, 0.0<=h<=Infinity)
... size: Size(393.4, 64.0)
... direction: horizontal
... mainAxisAlignment: center
... mainAxisSize: max
... crossAxisAlignment: start
... textDirection: ltr
... verticalDirection: down
... child 1: RenderConstrainedBox#60dfb relayoutBoundary=up15 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
... constraints: BoxConstraints(unconstrained)
... size: Size(308.6, 64.0)
... additionalConstraints: BoxConstraints(w=308.6, h=64.0)
... child: RenderPadding#44188 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: (can use size)
... constraints: BoxConstraints(w=308.6, h=64.0)
... size: Size(308.6, 64.0)
... padding: EdgeInsets(0.0, 8.0, 0.0, 8.0)
... textDirection: ltr
... child 2: RenderConstrainedBox#d9b1a relayoutBoundary=up15 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: offset=Offset(308.6, 0.0); flex=1; fit=FlexFit.tight (can use size)
... constraints: BoxConstraints(w=84.9, 0.0<=h<=Infinity)
... size: Size(84.9, 0.0)
... additionalConstraints: BoxConstraints(unconstrained)
... child 2: RenderFlex#c8db1 relayoutBoundary=up13 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: offset=Offset(0.0, 72.0); flex=null; fit=null (can use size)
... constraints: BoxConstraints(0.0<=w<=411.4, 0.0<=h<=Infinity)
... size: Size(411.4, 270.0)
... direction: vertical
... mainAxisAlignment: center
... mainAxisSize: max
... crossAxisAlignment: start
... textDirection: ltr
... verticalDirection: down
... child 1: RenderPadding#a4018 relayoutBoundary=up14 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
... constraints: BoxConstraints(0.0<=w<=411.4, 0.0<=h<=Infinity)
... size: Size(142.0, 33.0)
... padding: EdgeInsets(18.0, 8.0, 16.0, 0.0)
... textDirection: ltr
... child: RenderParagraph#aee67 relayoutBoundary=up15 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: offset=Offset(18.0, 8.0) (can use size)
... constraints: BoxConstraints(0.0<=w<=377.4, 0.0<=h<=Infinity)
... size: Size(108.0, 25.0)
... textAlign: left
... textDirection: ltr
... softWrap: wrapping at box width
... overflow: clip
... locale: en_US
... maxLines: unlimited
... text: TextSpan
... debugLabel: ((englishLike body1 2014).merge((blackMountainView body1).apply)).merge(unknown)
... inherit: false
... color: Color(0xff17262a)
... family: Comfortaa
... size: 22.0
... weight: 600
... letterSpacing: 0.3
... baseline: alphabetic
... decoration: TextDecoration.none
... "Category"
... child 2: RenderConstrainedBox#fd9bb relayoutBoundary=up14 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: offset=Offset(0.0, 33.0); flex=null; fit=null (can use size)
... constraints: BoxConstraints(0.0<=w<=411.4, 0.0<=h<=Infinity)
... size: Size(0.0, 16.0)
... additionalConstraints: BoxConstraints(0.0<=w<=Infinity, h=16.0)
... child 3: RenderPadding#85bf5 relayoutBoundary=up14 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: offset=Offset(0.0, 49.0); flex=null; fit=null (can use size)
... constraints: BoxConstraints(0.0<=w<=411.4, 0.0<=h<=Infinity)
... size: Size(411.4, 39.0)
... padding: EdgeInsets(16.0, 0.0, 16.0, 0.0)
... textDirection: ltr
... child: RenderFlex#b954d relayoutBoundary=up15 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: offset=Offset(16.0, 0.0) (can use size)
... constraints: BoxConstraints(0.0<=w<=379.4, 0.0<=h<=Infinity)
... size: Size(379.4, 39.0)
... direction: horizontal
... mainAxisAlignment: start
... mainAxisSize: max
... crossAxisAlignment: center
... textDirection: ltr
... verticalDirection: down
... child 1: RenderDecoratedBox#bcea6 relayoutBoundary=up16 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: offset=Offset(0.0, 0.0); flex=1; fit=FlexFit.tight (can use size)
... constraints: BoxConstraints(w=115.8, 0.0<=h<=Infinity)
... size: Size(115.8, 39.0)
... decoration: BoxDecoration
... color: Color(0xff00b6f0)
... border: Border.all(BorderSide(Color(0xff00b6f0), 1.0, BorderStyle.solid))
... borderRadius: BorderRadius.circular(24.0)
... configuration: ImageConfiguration(bundle: PlatformAssetBundle#a8b0c(), devicePixelRatio: 3.5, locale: en_US, textDirection: TextDirection.ltr, platform: android)
... child 2: RenderConstrainedBox#8a159 relayoutBoundary=up16 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: offset=Offset(115.8, 19.5); flex=null; fit=null (can use size)
... constraints: BoxConstraints(unconstrained)
... size: Size(16.0, 0.0)
... additionalConstraints: BoxConstraints(w=16.0, 0.0<=h<=Infinity)
... child 3: RenderDecoratedBox#84cf3 relayoutBoundary=up16 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: offset=Offset(131.8, 0.0); flex=1; fit=FlexFit.tight (can use size)
... constraints: BoxConstraints(w=115.8, 0.0<=h<=Infinity)
... size: Size(115.8, 39.0)
... decoration: BoxDecoration
... color: Color(0xffffffff)
... border: Border.all(BorderSide(Color(0xff00b6f0), 1.0, BorderStyle.solid))
... borderRadius: BorderRadius.circular(24.0)
... configuration: ImageConfiguration(bundle: PlatformAssetBundle#a8b0c(), devicePixelRatio: 3.5, locale: en_US, textDirection: TextDirection.ltr, platform: android)
... child 4: RenderConstrainedBox#95087 relayoutBoundary=up16 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: offset=Offset(247.6, 19.5); flex=null; fit=null (can use size)
... constraints: BoxConstraints(unconstrained)
... size: Size(16.0, 0.0)
... additionalConstraints: BoxConstraints(w=16.0, 0.0<=h<=Infinity)
... child 5: RenderDecoratedBox#6d2d9 relayoutBoundary=up16 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: offset=Offset(263.6, 0.0); flex=1; fit=FlexFit.tight (can use size)
... constraints: BoxConstraints(w=115.8, 0.0<=h<=Infinity)
... size: Size(115.8, 39.0)
... decoration: BoxDecoration
... color: Color(0xffffffff)
... border: Border.all(BorderSide(Color(0xff00b6f0), 1.0, BorderStyle.solid))
... borderRadius: BorderRadius.circular(24.0)
... configuration: ImageConfiguration(bundle: PlatformAssetBundle#a8b0c(), devicePixelRatio: 3.5, locale: en_US, textDirection: TextDirection.ltr, platform: android)
... child 4: RenderConstrainedBox#f819d relayoutBoundary=up14 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: offset=Offset(0.0, 88.0); flex=null; fit=null (can use size)
... constraints: BoxConstraints(0.0<=w<=411.4, 0.0<=h<=Infinity)
... size: Size(0.0, 16.0)
... additionalConstraints: BoxConstraints(0.0<=w<=Infinity, h=16.0)
... child 5: RenderPadding#f317b relayoutBoundary=up14 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: offset=Offset(0.0, 104.0); flex=null; fit=null (can use size)
... constraints: BoxConstraints(0.0<=w<=411.4, 0.0<=h<=Infinity)
... size: Size(411.4, 166.0)
... padding: EdgeInsets(0.0, 16.0, 0.0, 16.0)
... textDirection: ltr
... child: RenderConstrainedBox#73542 relayoutBoundary=up15 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: offset=Offset(0.0, 16.0) (can use size)
... constraints: BoxConstraints(0.0<=w<=411.4, 0.0<=h<=Infinity)
... size: Size(411.4, 134.0)
... additionalConstraints: BoxConstraints(w=Infinity, h=134.0)
... child: RenderRepaintBoundary#3b1e7 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: (can use size)
... constraints: BoxConstraints(w=411.4, h=134.0)
... layer: OffsetLayer#b1b39
... offset: Offset(0.0, 192.0)
... size: Size(411.4, 134.0)
... metrics: 0.0% useful (1 bad vs 0 good)
... diagnosis: insufficient data to draw conclusion (less than five repaints)
... child 3: RenderPadding#ba4cc NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: offset=Offset(0.0, 0.0); flex=1; fit=FlexFit.loose
... constraints: MISSING
... size: MISSING
... padding: EdgeInsets(18.0, 8.0, 16.0, 0.0)
... textDirection: ltr
... child: RenderFlex#0d4de NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: offset=Offset(0.0, 0.0)
... constraints: MISSING
... size: MISSING
... direction: vertical
... mainAxisAlignment: center
... mainAxisSize: max
... crossAxisAlignment: start
... textDirection: ltr
... verticalDirection: down
... child 1: RenderParagraph#fc91e NEEDS-LAYOUT NEEDS-PAINT
... parentData: offset=Offset(0.0, 0.0); flex=null; fit=null
... constraints: MISSING
... size: MISSING
... textAlign: left
... textDirection: ltr
... softWrap: wrapping at box width
... overflow: clip
... locale: en_US
... maxLines: unlimited
... text: TextSpan
... debugLabel: ((englishLike body1 2014).merge((blackMountainView body1).apply)).merge(unknown)
... inherit: false
... color: Color(0xff17262a)
... family: Comfortaa
... size: 22.0
... weight: 600
... letterSpacing: 0.3
... baseline: alphabetic
... decoration: TextDecoration.none
... "Popular Course"
... child 2: RenderPadding#01a16 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... parentData: offset=Offset(0.0, 0.0); flex=1; fit=FlexFit.loose
... constraints: MISSING
... size: MISSING
... padding: EdgeInsets(0.0, 8.0, 0.0, 0.0)
... textDirection: ltr
... child: RenderConstrainedBox#40171 NEEDS-LAYOUT NEEDS-PAINT
... parentData: offset=Offset(0.0, 0.0)
... constraints: MISSING
... size: MISSING
... additionalConstraints: BoxConstraints(unconstrained)
The creator information is set to: Column ← _SingleChildViewport ← IgnorePointer-[GlobalKey#7355c] ← Semantics ← _PointerListener ← Listener ← _GestureSemantics ← RawGestureDetector-[LabeledGlobalKey#272ae] ← _PointerListener ← Listener ← _ScrollableScope ← _ScrollSemantics-[GlobalKey#04bc2] ← ⋯
The nearest ancestor providing an unbounded width constraint is: _RenderSingleChildViewport#ddc21 relayoutBoundary=up11 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: (can use size)
... constraints: BoxConstraints(0.0<=w<=411.4, h=591.4)
... layer: OffsetLayer#406c6
... offset: Offset(0.0, 0.0)
... size: Size(411.4, 591.4)
Expected behavior A clear and concise description of what you expected to happen.
Desktop (please complete the following information):
Smartphone (please complete the following information):