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...)
Related
I want to build a page that contains so many widgets.
That page's widget tree is like this.
Material
Scaffold
SafeArea
NestedScrollView
TabBarView
ScrollConfiguration
SingleChildScrollView
Column
NestedScrollView
ScrollConfiguration
TabBarView
Everything was fine before the last TabBarView was added.
After adding the last TabBarView, the page was not displayed in my device screen.
And this error was logged.
The following assertion was thrown during performResize():
Horizontal viewport was given unbounded height.
Viewports expand in the cross axis to fill their container and constrain their children to match their extent in the cross axis. In this case, a horizontal viewport was given an unlimited amount of vertical space in which to expand.
The following assertion was thrown during performLayout():
RenderBox was not laid out: RenderViewport#cf3d7 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1979 pos 12: 'hasSize'
And, this is the Widget contains the last TabBarView.
Widget build(BuildContext context) {
return NestedScrollView(
headerSliverBuilder: (context, value) {
return [
SliverToBoxAdapter(child: AreaTypeDesignTabBar()),
];
},
body: ScrollConfiguration(
behavior: NonGlowScrollBehavior(),
child: TabBarView(
physics: const NeverScrollableScrollPhysics(),
controller: _tabController.tabController,
children: [
VisionWidget(
areaType: AreaType.CAREER,
visionText: getVisionByAreaType(AreaType.CAREER),
),
VisionWidget(
areaType: AreaType.STUDY,
visionText: getVisionByAreaType(AreaType.STUDY),
),
VisionWidget(
areaType: AreaType.SOCIAL,
visionText: getVisionByAreaType(AreaType.SOCIAL),
),
],
),
),
);
}
Maybe, because the height of TabBarView is not static, so the upper SingleChildScrollView could not be rendered.
To Solve this problem, I tried to wrap the second picture's Column with Expanded, but failed.
Also, I tried to only wrap the second picture's TabBarView with Expanded, but failed...
In this situation, how do I set the TabBarView's height dynamically??
I have a dialog with a button and I want to add a horizontal scroll next to the button, so this way the button is fixed in the left and the scroll is in the right. I tried using a Row but I got the following error:
The following assertion was thrown during performResize():
Horizontal viewport was given unbounded width.
.
.
.
The following assertion was thrown during performLayout():
RenderBox was not laid out: RenderViewport#48cb5 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1982 pos 12: 'hasSize'
.
.
.
The specific code I used for this is the following:
SizedBox(
height: 80,
child: Row(
children: <Widget>[
AddUsersButton(newTaskCubit: newTaskCubit),
SizedBox(
height: 80,
child: ListView(
scrollDirection: Axis.horizontal,
children: <Widget>[
UserExample(newTaskCubit: newTaskCubit),
UserExample(newTaskCubit: newTaskCubit),
UserExample(newTaskCubit: newTaskCubit),
UserExample(newTaskCubit: newTaskCubit),
],
),
)
],
),
),
Give SizeBox() width also and use shrikWrap with your Listview .As the scroll is Horizontal its asking for you a fixed widht.
You can use shrinkWrap: true, on ListView
SizedBox(
height: 80,
child: ListView(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
children: <Widget>[....],
),
You can check more about What does the shrinkWrap property do in Flutter?
The ListView is not working. I want to display 3 different stateful widgets to a inside list view but I am getting error
Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderViewport#01b62 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
Column(
children: <Widget>[
//wrap with list of widget
ListView(
children: [
Expanded(child: Body(box.get('state'), true)),
Divider(color: Colors.black),
Expanded(child: Body(box.get('state'), false)),
],
)
],
),
I am using this code to display widgets inside ListView.
my Body widget return listview.builder or sometimes simple text widget.
When I not using only column widget screen splits in two part - upper listview.builder and lower listview.builder
and when I am using this code it throwing an error.
Desired output-
first body widget should be display in entire screen and once first widget end second body widget should be display in entire screen.
How to do this? And why does this error occur?
Note: shrinkwrap is true inside Body widget(listview.builder).
You need to add this code
physics: NeverScrollableScrollPhysics(),
in the all ListView.builder,
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.
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.