I have a problem with my code, and I don't know what's going on because nothing lights up.
When I reload my code, and click something on the screen my terminal shows this :
> ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
The following assertion was thrown during performResize():
Vertical viewport was given unbounded height.
Viewports expand in the scrolling direction to fill their container. In this case, a vertical
viewport was given an unlimited amount of vertical space in which to expand. This situation
typically happens when a scrollable widget is nested inside another scrollable widget.
If this widget is always nested in a scrollable widget there is no need to use a viewport because
there will always be enough vertical space for the children. In this case, consider using a Column
instead. Otherwise, consider using the "shrinkWrap" property (or a ShrinkWrappingViewport) to size
the height of the viewport to the sum of the heights of its children.
The relevant error-causing widget was:
ListView
file:///Users/dominikkolber/Desktop/algotrading/worked_project/lib/widgets/transactions_list.dart:15:25
When the exception was thrown, this was the stack:
#0 RenderViewport.computeDryLayout.<anonymous closure> (package:flutter/src/rendering/viewport.dart:1365:15)
#1 RenderViewport.computeDryLayout (package:flutter/src/rendering/viewport.dart:1426:6)
#2 RenderBox.performResize (package:flutter/src/rendering/box.dart:2342:12)
#3 RenderObject.layout (package:flutter/src/rendering/object.dart:1763:9)
#4 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#5 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#6 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#7 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#8 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#9 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#10 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#11 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#12 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#13 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#14 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#15 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#16 RenderConstrainedBox.performLayout (package:flutter/src/rendering/proxy_box.dart:279:14)
#17 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#18 ChildLayoutHelper.layoutChild (package:flutter/src/rendering/layout_helper.dart:54:11)
#19 RenderFlex._computeSizes (package:flutter/src/rendering/flex.dart:897:45)
#20 RenderFlex.performLayout (package:flutter/src/rendering/flex.dart:932:32)
#21 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#22 ChildLayoutHelper.layoutChild (package:flutter/src/rendering/layout_helper.dart:54:11)
#23 RenderFlex._computeSizes (package:flutter/src/rendering/flex.dart:830:43)
#24 RenderFlex.performLayout (package:flutter/src/rendering/flex.dart:932:32)
#25 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#26 _RenderSingleChildViewport.performLayout (package:flutter/src/widgets/single_child_scroll_view.dart:558:14)
#27 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#28 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#29 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#30 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#31 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#32 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#33 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#34 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#35 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#36 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#37 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#38 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#39 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#40 MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:171:12)
#41 _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:925:7)
#42 MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:243:7)
#43 RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:407:14)
#44 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#45 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#46 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#47 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#48 _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1371:11)
#49 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#50 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#51 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#52 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#53 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#54 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#55 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#56 ChildLayoutHelper.layoutChild (package:flutter/src/rendering/layout_helper.dart:54:11)
#57 RenderStack._computeSize (package:flutter/src/rendering/stack.dart:570:43)
#58 RenderStack.performLayout (package:flutter/src/rendering/stack.dart:597:12)
#59 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#60 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#61 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#62 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#63 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#64 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#65 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#66 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#67 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#68 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#69 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#70 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#71 RenderOffstage.performLayout (package:flutter/src/rendering/proxy_box.dart:3362:13)
#72 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#73 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#74 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#75 _RenderTheatre.performLayout (package:flutter/src/widgets/overlay.dart:743:15)
#76 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#77 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#78 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#79 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#80 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#81 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#82 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#83 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#84 RenderCustomPaint.performLayout (package:flutter/src/rendering/custom_paint.dart:546:11)
#85 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#86 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#87 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#88 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:118:14)
#89 RenderObject.layout (package:flutter/src/rendering/object.dart:1784:7)
#90 RenderView.performLayout (package:flutter/src/rendering/view.dart:153:14)
#91 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1641:7)
#92 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:884:18)
#93 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:453:19)
#94 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:874:13)
#95 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:319:5)
#96 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1144:15)
#97 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1082:9)
#98 SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:865:7)
(elided 11 frames from class _RawReceivePortImpl, class _Timer, dart:async, and dart:async-patch)
The following RenderObject was being processed when the exception was fired: RenderViewport#cbc71 NEEDS-LAYOUT
NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE:
needs compositing
creator: Viewport ← IgnorePointer-[GlobalKey#28017] ← Semantics ← Listener ← _GestureSemantics ←
RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#e8dad] ← Listener ← _ScrollableScope
← _ScrollSemantics-[GlobalKey#d4bfb] ← Scrollable ← ListView ← ConstrainedBox ← ⋯
parentData: <none> (can use size)
constraints: BoxConstraints(w=300.0, 0.0<=h<=Infinity)
size: MISSING
axisDirection: down
crossAxisDirection: right
offset: ScrollPositionWithSingleContext#a246f(offset: 0.0, range: null..null, viewport: null,
ScrollableState, AlwaysScrollableScrollPhysics -> BouncingScrollPhysics ->
RangeMaintainingScrollPhysics, IdleScrollActivity#b67a4, ScrollDirection.idle)
anchor: 0.0
This RenderObject had the following descendants (showing up to depth 5):
center child: RenderSliverPadding#ab96d NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
child: RenderSliverList#474d3 NEEDS-LAYOUT NEEDS-PAINT
════════════════════════════════════════════════════════════════════════════════════════════════════
Another exception was thrown: RenderBox was not laid out: RenderViewport#cbc71 NEEDS-LAYOUT NEEDS-PAINT
NEEDS-COMPOSITING-BITS-UPDATE
Another exception was thrown: RenderBox was not laid out: RenderViewport#cbc71 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
Another exception was thrown: RenderBox was not laid out: RenderIgnorePointer#14767 relayoutBoundary=up16 NEEDS-PAINT
NEEDS-COMPOSITING-BITS-UPDATE
Another exception was thrown: RenderBox was not laid out: RenderSemanticsAnnotations#8657d relayoutBoundary=up15
NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
Another exception was thrown: RenderBox was not laid out: RenderPointerListener#b5a18 relayoutBoundary=up14 NEEDS-PAINT
NEEDS-COMPOSITING-BITS-UPDATE
Another exception was thrown: RenderBox was not laid out: RenderSemanticsGestureHandler#fffbd relayoutBoundary=up13
NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
Another exception was thrown: RenderBox was not laid out: RenderPointerListener#12b1c relayoutBoundary=up12 NEEDS-PAINT
NEEDS-COMPOSITING-BITS-UPDATE
Another exception was thrown: RenderBox was not laid out: _RenderScrollSemantics#59657 relayoutBoundary=up11 NEEDS-PAINT
NEEDS-COMPOSITING-BITS-UPDATE
Another exception was thrown: RenderBox was not laid out: RenderConstrainedBox#69ea6 relayoutBoundary=up10 NEEDS-PAINT
NEEDS-COMPOSITING-BITS-UPDATE
Another exception was thrown: RenderBox was not laid out: RenderFlex#0e0b0 relayoutBoundary=up9 NEEDS-PAINT
NEEDS-COMPOSITING-BITS-UPDATE
Another exception was thrown: RenderBox was not laid out: RenderFlex#a112f relayoutBoundary=up8 NEEDS-PAINT
NEEDS-COMPOSITING-BITS-UPDATE
Another exception was thrown: RenderBox was not laid out: _RenderSingleChildViewport#45682 relayoutBoundary=up7
NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
Another exception was thrown: RenderBox was not laid out: RenderIgnorePointer#8bbd3 relayoutBoundary=up6 NEEDS-PAINT
NEEDS-COMPOSITING-BITS-UPDATE
Another exception was thrown: RenderBox was not laid out: RenderSemanticsAnnotations#617d0 relayoutBoundary=up5
NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
Another exception was thrown: RenderBox was not laid out: RenderPointerListener#dffcd relayoutBoundary=up4 NEEDS-PAINT
NEEDS-COMPOSITING-BITS-UPDATE
Another exception was thrown: RenderBox was not laid out: RenderSemanticsGestureHandler#66524 relayoutBoundary=up3
NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
Another exception was thrown: RenderBox was not laid out: RenderPointerListener#5238d relayoutBoundary=up2 NEEDS-PAINT
NEEDS-COMPOSITING-BITS-UPDATE
Another exception was thrown: RenderBox was not laid out: _RenderScrollSemantics#01cd6 relayoutBoundary=up1 NEEDS-PAINT
NEEDS-COMPOSITING-BITS-UPDATE
Another exception was thrown: RenderBox was not laid out: _RenderSingleChildViewport#45682 relayoutBoundary=up7
NEEDS-PAINT
Another exception was thrown: Null check operator used on a null value
Another exception was thrown: Bad state: Future already completed
[VERBOSE-2:ui_dart_state.cc(186)] Unhandled Exception: 'package:flutter/src/rendering/box.dart': Failed assertion: line 1940 pos 12: 'hasSize': RenderBox was not laid out: RenderPointerListener#14f8e NEEDS-LAYOUT NEEDS-PAINT
#0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:46:39)
#1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5)
#2 RenderBox.size (package:flutter/src/rendering/box.dart:1940:12)
#3 RenderProxyBoxWithHitTestBehavior.hitTest (package:flutter/src/rendering/proxy_box.dart:179:9)
#4 RenderBoxContainerDefaultsMixin.defaultHitTestChildren.<anonymous closure> (package:flutter/src/rendering/box.dart:2785:25)
#5 BoxHitTestResult.addWithPaintOffset (package:flutter/src/rendering/box.dart:787:31)
#6 RenderBoxContainerDefaultsMixin.defaultHitTestChildren (package:flutter/src/rendering/box.dart:2780:33)
#7 RenderCustomMultiChildLayoutBox.hitTestChildren (package:flutter/src/rendering/custom_layout.dart:417:12)
#8 Rend<…>
[VERBOSE-2:ui_dart_state.cc(186)] Unhandled Exception: 'package:flutter/src/rendering/box.dart': Failed assertion: line 1940 pos 12: 'hasSize': RenderBox was not laid out: RenderPointerListener#14f8e NEEDS-LAYOUT NEEDS-PAINT
#0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:46:39)
#1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5)
#2 RenderBox.size (package:flutter/src/rendering/box.dart:1940:12)
#3 RenderProxyBoxWithHitTestBehavior.hitTest (package:flutter/src/rendering/proxy_box.dart:179:9)
#4 RenderBoxContainerDefaultsMixin.defaultHitTestChildren.<anonymous closure> (package:flutter/src/rendering/box.dart:2785:25)
#5 BoxHitTestResult.addWithPaintOffset (package:flutter/src/rendering/box.dart:787:31)
#6 RenderBoxContainerDefaultsMixin.defaultHitTestChildren (package:flutter/src/rendering/box.dart:2780:33)
#7 RenderCustomMultiChildLayoutBox.hitTestChildren (package:flutter/src/rendering/custom_layout.dart:417:12)
#8 Rend<…>
I really don't know what's the problem i was watching one of tutorial, below is my code if someone want to help
https://gist.github.com/agentkolby/313a65939eb4a8e0a136f5fa7bc36925
Please try below. Change the code in user_transactions.dart
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: <Widget>[
NewTransaction(_addNewTransaction),
TransactionList(_userTransactions),
],
),
);
}
You can cannot use Expanded in Column.
Related
This is my problem and I don't know how can fix it. Please help me
Github of this project: here
Launching lib/main.dart on iPhone SE (2nd generation) in debug mode...
Running Xcode build...
Xcode build done. 22.0s
Configuring the default Firebase app...
Configured the default Firebase app __FIRAPP_DEFAULT.
Waiting for iPhone SE (2nd generation) to report its views...
Debug service listening on ws://127.0.0.1:54630/tFUTjcfl640=/ws
Syncing files to device iPhone SE (2nd generation)...
flutter: ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
flutter: The following assertion was thrown building StreamBuilder<CalendarDetailModel>(dirty, state:
flutter: _StreamBuilderBaseState<CalendarDetailModel, AsyncSnapshot<CalendarDetailModel>>#836df):
flutter: A build function returned null.
flutter: The offending widget is:
flutter: StreamBuilder<CalendarDetailModel>
flutter: Build functions must never return null.
flutter: To return an empty space that causes the building widget to fill available room, return
flutter: "Container()". To return an empty space that takes as little room as possible, return
flutter: "Container(width: 0.0, height: 0.0)".
flutter:
flutter: The relevant error-causing widget was:
flutter: StreamBuilder<CalendarDetailModel>
flutter: file:///Users/lethanhtu/Desktop/firebase_authentication/lib/ui/calendar_detail.dart:54:20
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #0 debugWidgetBuilderValue.<anonymous closure> (package:flutter/src/widgets/debug.dart:276:7)
flutter: #1 debugWidgetBuilderValue (package:flutter/src/widgets/debug.dart:297:4)
flutter: #2 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4516:7)
flutter: #3 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4684:11)
flutter: #4 Element.rebuild (package:flutter/src/widgets/framework.dart:4227:5)
flutter: #5 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4490:5)
flutter: #6 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4675:11)
flutter: #7 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4485:5)
flutter: ... Normal element mounting (39 frames)
flutter: #46 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3455:14)
flutter: #47 Element.updateChild (package:flutter/src/widgets/framework.dart:3223:18)
flutter: #48 SliverMultiBoxAdaptorElement.updateChild (package:flutter/src/widgets/sliver.dart:1162:36)
flutter: #49 SliverMultiBoxAdaptorElement.createChild.<anonymous closure> (package:flutter/src/widgets/sliver.dart:1147:20)
flutter: #50 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2612:19)
flutter: #51 SliverMultiBoxAdaptorElement.createChild (package:flutter/src/widgets/sliver.dart:1140:11)
flutter: #52 RenderSliverMultiBoxAdaptor._createOrObtainChild.<anonymous closure> (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:354:23)
flutter: #53 RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:1866:58)
flutter: #54 PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:918:15)
flutter: #55 RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:1866:13)
flutter: #56 RenderSliverMultiBoxAdaptor._createOrObtainChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:343:5)
flutter: #57 RenderSliverMultiBoxAdaptor.addInitialChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:427:5)
flutter: #58 RenderSliverList.performLayout (package:flutter/src/rendering/sliver_list.dart:79:12)
flutter: #59 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #60 RenderSliverEdgeInsetsPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:135:11)
flutter: #61 RenderSliverPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:375:11)
flutter: #62 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #63 RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:452:13)
flutter: #64 RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1443:12)
flutter: #65 RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1352:20)
flutter: #66 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #67 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:113:13)
flutter: #68 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #69 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:113:13)
flutter: #70 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #71 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:113:13)
flutter: #72 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #73 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:113:13)
flutter: #74 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #75 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:113:13)
flutter: #76 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #77 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:113:13)
flutter: #78 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #79 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:113:13)
flutter: #80 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #81 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:113:13)
flutter: #82 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #83 RenderPadding.performLayout (package:flutter/src/rendering/shifted_box.dart:207:11)
flutter: #84 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #85 MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:171:11)
flutter: #86 _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:480:7)
flutter: #87 MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:240:7)
flutter: #88 RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:399:14)
flutter: #89 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #90 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:113:13)
flutter: #91 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #92 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:113:13)
flutter: #93 _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1267:11)
flutter: #94 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #95 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:113:13)
flutter: #96 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #97 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:113:13)
flutter: #98 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #99 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:113:13)
flutter: #100 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #101 RenderStack.performLayout (package:flutter/src/rendering/stack.dart:556:15)
flutter: #102 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #103 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:113:13)
flutter: #104 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #105 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:113:13)
flutter: #106 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #107 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:113:13)
flutter: #108 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #109 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:113:13)
flutter: #110 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #111 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:113:13)
flutter: #112 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #113 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:113:13)
flutter: #114 RenderOffstage.performLayout (package:flutter/src/rendering/proxy_box.dart:3219:13)
flutter: #115 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #116 _RenderTheatre.performLayout (package:flutter/src/widgets/overlay.dart:700:15)
flutter: #117 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #118 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:113:13)
flutter: #119 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #120 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:113:13)
flutter: #121 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #122 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:113:13)
flutter: #123 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #124 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:113:13)
flutter: #125 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #126 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:113:13)
flutter: #127 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
flutter: #128 RenderView.performLayout (package:flutter/src/rendering/view.dart:167:13)
flutter: #129 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1630:7)
flutter: #130 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:887:18)
flutter: #131 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:402:19)
flutter: #132 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:865:13)
flutter: #133 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:284:5)
flutter: #134 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1113:15)
flutter: #135 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1052:9)
flutter: #136 SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:861:7)
flutter: (elided 11 frames from class _RawReceivePortImpl, class _Timer, dart:async, and dart:async-patch)
flutter:
flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════
flutter: Status code is 200
[VERBOSE-2:ui_dart_state.cc(166)] Unhandled Exception: type 'List<dynamic>' is not a subtype of type 'Map<String, String>'
#0 new CalendarDetailModel (package:firebaseauthentication/models/calendar_detail_model.dart:26:40)
#1 CalendarDetailRepository.fetchRoom.<anonymous closure> (package:firebaseauthentication/resources/calendar_detail_repository.dart:38:23)
#2 List.forEach (dart:core-patch/growable_array.dart:289:8)
#3 CalendarDetailRepository.fetchRoom (package:firebaseauthentication/resources/calendar_detail_repository.dart:35:19)
<asynchronous suspension>
#4 CalendarDetailBloc.loadRoom (package:firebaseauthentication/blocs/calendar_detail_bloc.dart:16:36)
#5 CalendarDetailsState.initState (package:firebaseauthentication/ui/calendar_detail.dart:35:10)
#6 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4649:58)
#7 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4485:5)
#8 Element.inflateWidget (package:flutter/<…>
════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The following assertion was thrown building StreamBuilder<CalendarDetailModel>(dirty, state: _StreamBuilderBaseState<CalendarDetailModel, AsyncSnapshot<CalendarDetailModel>>#836df):
A build function returned null.
The offending widget is: StreamBuilder<CalendarDetailModel>
Build functions must never return null.
To return an empty space that causes the building widget to fill available room, return "Container()". To return an empty space that takes as little room as possible, return "Container(width: 0.0, height: 0.0)".
The relevant error-causing widget was:
StreamBuilder<CalendarDetailModel> file:///Users/lethanhtu/Desktop/firebase_authentication/lib/ui/calendar_detail.dart:54:20
When the exception was thrown, this was the stack:
#0 debugWidgetBuilderValue.<anonymous closure> (package:flutter/src/widgets/debug.dart:276:7)
#1 debugWidgetBuilderValue (package:flutter/src/widgets/debug.dart:297:4)
#2 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4516:7)
#3 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4684:11)
#4 Element.rebuild (package:flutter/src/widgets/framework.dart:4227:5)
...
════════════════════════════════════════════════════════════════════════════════════════════════════
The error is quite clear about what the issue is. In you StreamBuilder you are not awlays returning something. You have:
builder: (context, snapshot) {
if (snapshot.hasError) {
return CircularProgressIndicator();
} else if (snapshot.hasData) {
...
}
which only returns something on an error or when data is available. However, there won't always be data available or an error, so you have to return something when neither of these conditions are true.
Simply adding return CircularProgressIndicator(); outside of these if-else blocks or in an else statement will solve your issue.
Ex.
builder: (context, snapshot) {
if (snapshot.hasError) {
return CircularProgressIndicator();
} else if (snapshot.hasData) {
...
}
else {
return CircularProgressIndicator();
}
Following the instructions that these errors provide can save you a lot of time and takes away the need to ask here on SO.
I have a TabBar to switch between login and register, both of them are Stateful widgets.
When the Navigator is commented, there is no error. If Navigator is not commented the error mentioned below is thrown.
Providing relevant code below -
Login/Register Tab View
Flexible(
child: TabBarView(
children: [
Login(), // A Stateful Widget,
Register(),
],
),
),
Login Submit Button -
Padding(
padding: const EdgeInsets.only(top: 20.0),
child: MaterialButton(
color: Theme.of(context).accentColor,
textColor: Colors.white,
onPressed: loginPressed(context),
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Text('Login'),
),
),
),
function loginPressed() -
loginPressed(BuildContext context) {
//Will Be conditions here right now redirection for sake of testing
Navigator.pushReplacementNamed(context, 'home');
}
Error -
I/flutter ( 4421): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter ( 4421): The following assertion was thrown building Login(dirty, dependencies: [_InheritedTheme,
I/flutter ( 4421): _LocalizationsScope-[GlobalKey#5872b]], state: _LoginState#6fe41):
I/flutter ( 4421): setState() or markNeedsBuild() called during build.
I/flutter ( 4421): This Overlay widget cannot be marked as needing to build because the framework is already in the
I/flutter ( 4421): process of building widgets. A widget can be marked as needing to be built during the build phase
I/flutter ( 4421): only if one of its ancestors is currently building. This exception is allowed because the framework
I/flutter ( 4421): builds parent widgets before children, which means a dirty descendant will always be built.
I/flutter ( 4421): Otherwise, the framework might not visit this widget during this build phase.
I/flutter ( 4421): The widget on which setState() or markNeedsBuild() was called was:
I/flutter ( 4421): Overlay-[LabeledGlobalKey<OverlayState>#e1e0c]
I/flutter ( 4421): The widget which was currently being built when the offending call was made was:
I/flutter ( 4421): Login
I/flutter ( 4421):
I/flutter ( 4421): The relevant error-causing widget was:
I/flutter ( 4421): Login file:///D:/flutter_projects/project/lib/screens/login_reg.dart:50:23
I/flutter ( 4421):
I/flutter ( 4421): When the exception was thrown, this was the stack:
I/flutter ( 4421): #0 Element.markNeedsBuild.<anonymous closure> (package:flutter/src/widgets/framework.dart:3896:11)
I/flutter ( 4421): #1 Element.markNeedsBuild (package:flutter/src/widgets/framework.dart:3911:6)
I/flutter ( 4421): #2 State.setState (package:flutter/src/widgets/framework.dart:1168:14)
I/flutter ( 4421): #3 OverlayState.insertAll (package:flutter/src/widgets/overlay.dart:344:5)
I/flutter ( 4421): #4 OverlayRoute.install (package:flutter/src/widgets/routes.dart:44:24)
I/flutter ( 4421): #5 TransitionRoute.install (package:flutter/src/widgets/routes.dart:181:11)
I/flutter ( 4421): #6 ModalRoute.install (package:flutter/src/widgets/routes.dart:959:11)
I/flutter ( 4421): #7 NavigatorState.pushReplacement (package:flutter/src/widgets/navigator.dart:1883:14)
I/flutter ( 4421): #8 NavigatorState.pushReplacementNamed (package:flutter/src/widgets/navigator.dart:1710:12)
I/flutter ( 4421): #9 Navigator.pushReplacementNamed (package:flutter/src/widgets/navigator.dart:972:34)
I/flutter ( 4421): #10 _LoginState.loginPressed (package:project/screens/login.dart:72:15)
I/flutter ( 4421): #11 _LoginState.build (package:project/screens/login.dart:57:30)
I/flutter ( 4421): #12 StatefulElement.build (package:flutter/src/widgets/framework.dart:4334:27)
I/flutter ( 4421): #13 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4223:15)
I/flutter ( 4421): #14 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5)
I/flutter ( 4421): #15 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5)
I/flutter ( 4421): #16 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4381:11)
I/flutter ( 4421): #17 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
I/flutter ( 4421): #18 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
I/flutter ( 4421): #19 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
I/flutter ( 4421): #20 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16)
I/flutter ( 4421): #21 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5)
I/flutter ( 4421): #22 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5)
I/flutter ( 4421): #23 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
I/flutter ( 4421): #24 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
I/flutter ( 4421): #25 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
I/flutter ( 4421): #26 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14)
I/flutter ( 4421): #27 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
I/flutter ( 4421): #28 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
I/flutter ( 4421): #29 SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14)
I/flutter ( 4421): #30 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
I/flutter ( 4421): #31 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
I/flutter ( 4421): #32 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16)
I/flutter ( 4421): #33 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5)
I/flutter ( 4421): #34 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5)
I/flutter ( 4421): #35 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
I/flutter ( 4421): #36 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
I/flutter ( 4421): #37 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
I/flutter ( 4421): #38 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16)
I/flutter ( 4421): #39 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5)
I/flutter ( 4421): #40 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5)
I/flutter ( 4421): #41 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
I/flutter ( 4421): #42 ParentDataElement.mount (package:flutter/src/widgets/framework.dart:4617:11)
I/flutter ( 4421): #43 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
I/flutter ( 4421): #44 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
I/flutter ( 4421): #45 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16)
I/flutter ( 4421): #46 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5)
I/flutter ( 4421): #47 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5)
I/flutter ( 4421): #48 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4381:11)
I/flutter ( 4421): #49 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
I/flutter ( 4421): #50 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
I/flutter ( 4421): #51 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
I/flutter ( 4421): #52 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16)
I/flutter ( 4421): #53 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5)
I/flutter ( 4421): #54 ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5)
I/flutter ( 4421): #55 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
I/flutter ( 4421): #56 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
I/flutter ( 4421): #57 Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
I/flutter ( 4421): #58 SliverMultiBoxAdaptorElement.updateChild (package:flutter/src/widgets/sliver.dart:1288:36)
I/flutter ( 4421): #59 SliverMultiBoxAdaptorElement.createChild.<anonymous closure> (package:flutter/src/widgets/sliver.dart:1273:20)
I/flutter ( 4421): #60 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2412:19)
I/flutter ( 4421): #61 SliverMultiBoxAdaptorElement.createChild (package:flutter/src/widgets/sliver.dart:1266:11)
I/flutter ( 4421): #62 RenderSliverMultiBoxAdaptor._createOrObtainChild.<anonymous closure> (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:354:23)
I/flutter ( 4421): #63 RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:1823:58)
I/flutter ( 4421): #64 PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:875:15)
I/flutter ( 4421): #65 RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:1823:13)
I/flutter ( 4421): #66 RenderSliverMultiBoxAdaptor._createOrObtainChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:343:5)
I/flutter ( 4421): #67 RenderSliverMultiBoxAdaptor.addInitialChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:427:5)
I/flutter ( 4421): #68 RenderSliverFixedExtentBoxAdaptor.performLayout (package:flutter/src/rendering/sliver_fixed_extent_list.dart:196:12)
I/flutter ( 4421): #69 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #70 RenderSliverEdgeInsetsPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:134:11)
I/flutter ( 4421): #71 _RenderSliverFractionalPadding.performLayout (package:flutter/src/widgets/sliver.dart:1165:11)
I/flutter ( 4421): #72 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #73 RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:410:13)
I/flutter ( 4421): #74 RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1367:12)
I/flutter ( 4421): #75 RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1285:20)
I/flutter ( 4421): #76 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #77 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #78 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #79 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #80 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #81 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #82 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #83 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #84 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #85 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #86 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #87 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #88 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #89 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #90 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #91 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #92 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #93 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #94 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #95 RenderFlex.performLayout (package:flutter/src/rendering/flex.dart:806:17)
I/flutter ( 4421): #96 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #97 RenderPositionedBox.performLayout (package:flutter/src/rendering/shifted_box.dart:392:13)
I/flutter ( 4421): #98 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #99 MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:163:11)
I/flutter ( 4421): #100 _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:477:7)
I/flutter ( 4421): #101 MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:232:7)
I/flutter ( 4421): #102 RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:391:14)
I/flutter ( 4421): #103 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #104 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #105 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #106 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #107 _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1232:11)
I/flutter ( 4421): #108 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #109 RenderPadding.performLayout (package:flutter/src/rendering/shifted_box.dart:206:11)
I/flutter ( 4421): #110 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #111 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #112 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #113 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #114 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #115 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #116 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #117 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #118 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #119 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #120 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #121 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #122 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #123 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter ( 4421): #124 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
I/flutter ( 4421): #125 RenderOffstage.performLayout (package:flutter/src/rendering/proxy_box.dart:3166:14)
I/flutter ( 4421): #126 RenderObject.layout (package:flutter/src/rendering/object.dart:1724:7)
════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The following NoSuchMethodError was thrown building _OverlayEntry-[LabeledGlobalKey<_OverlayEntryState>#09487](dirty, state: _OverlayEntryState#46afb):
The getter 'status' was called on null.
Receiver: null
Tried calling: status
The relevant error-causing widget was:
MaterialApp file:///D:/flutter_projects/project/lib/main.dart:36:12
When the exception was thrown, this was the stack:
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:53:5)
#1 ModalRoute._buildModalBarrier (package:flutter/src/widgets/routes.dart:1305:27)
#2 _OverlayEntryState.build (package:flutter/src/widgets/overlay.dart:169:25)
#3 StatefulElement.build (package:flutter/src/widgets/framework.dart:4334:27)
#4 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4223:15)
...
════════════════════════════════════════════════════════════════════════════════════════════════════
════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The method 'drive' was called on null.
Receiver: null
Tried calling: drive<Offset>(Instance of '_ChainedEvaluation<Offset>')
The relevant error-causing widget was:
MaterialApp file:///D:/flutter_projects/project/lib/main.dart:36:12
════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter ( 4421): #127 RenderStack.performLayout (package:flutter/src/rendering/stack.dart:505:15)
I/flutter ( 4421): #128 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1584:7)
I/flutter ( 4421): #129 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:844:18)
I/flutter ( 4421): #130 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:344:19)
I/flutter ( 4421): #131 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:774:13)
I/flutter ( 4421): #132 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:283:5)
I/flutter ( 4421): #133 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1102:15)
I/flutter ( 4421): #134 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1041:9)
I/flutter ( 4421): #135 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:957:5)
I/flutter ( 4421): #139 _invoke (dart:ui/hooks.dart:259:10)
I/flutter ( 4421): #140 _drawFrame (dart:ui/hooks.dart:217:3)
I/flutter ( 4421): (elided 3 frames from package dart:async)
I/flutter ( 4421):
I/flutter ( 4421): ════════════════════════════════════════════════════════════════════════════════════════════════════
Have no idea what has gone wrong.
In your widget building code, you are calling that loginPressed method.
Remember, when you write the following code:
loginPressed(context)
it's actually calling/executing that function. So, you are actually trying to navigate to another page while the current widget is still building. That's the reason why you are getting the exception.
You can fix it in 2 ways:
Method 1:
Change your onPressed code like:
onPressed: () {
loginPressed(context);
}
Method 2:
Pass the function reference (You don't need to pass the context, the function will already have access to that):
onPressed:loginPressed,
And change the function like:
loginPressed() {
Navigator.pushReplacementNamed(context, 'home');
}
Actually I am working on Login page with Bloc. So when I press submit button, it does business logic on bloc then trying to navigate to home page based on the result. I tried this
Widget submitButton() {
return StreamBuilder(
stream: bloc.submitStream,
builder: (context, snapshot) {
if (snapshot.data == "Success") {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => RegisterPage(),
),
);
}
return RaisedButton(
child: Text("Submit"),
onPressed: () {
bloc.submitSink.add(null);
},
);
},
);
}
But I got error like this The widget which was currently being built when the offending call was made....
Later then I found two solution:
1. Using SchedulerBinding,
2. Using WidgetsBinding. So what is the difference between SchedulerBinding and WidgetsBinding. Which one do I have to use?
Full Error Log:
I/flutter (17893): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (17893): The following assertion was thrown building LayoutBuilder:
I/flutter (17893): setState() or markNeedsBuild() called during build.
I/flutter (17893): This Overlay widget cannot be marked as needing to build because the framework is already in the
I/flutter (17893): process of building widgets. A widget can be marked as needing to be built during the build phase
I/flutter (17893): only if one of its ancestors is currently building. This exception is allowed because the framework
I/flutter (17893): builds parent widgets before children, which means a dirty descendant will always be built.
I/flutter (17893): Otherwise, the framework might not visit this widget during this build phase.
I/flutter (17893): The widget on which setState() or markNeedsBuild() was called was:
I/flutter (17893): Overlay-[LabeledGlobalKey<OverlayState>#70089](state: OverlayState#3bf13(entries:
I/flutter (17893): [OverlayEntry#9280a(opaque: false; maintainState: false), OverlayEntry#1af87(opaque: false;
I/flutter (17893): maintainState: true), OverlayEntry#9fb49(opaque: false; maintainState: false),
I/flutter (17893): OverlayEntry#87589(opaque: false; maintainState: true)]))
I/flutter (17893): The widget which was currently being built when the offending call was made was:
I/flutter (17893): LayoutBuilder(renderObject: _RenderLayoutBuilder#d3baf relayoutBoundary=up1 NEEDS-LAYOUT
I/flutter (17893): NEEDS-PAINT)
I/flutter (17893):
I/flutter (17893): When the exception was thrown, this was the stack:
I/flutter (17893): #0 Element.markNeedsBuild.<anonymous closure> (package:flutter/src/widgets/framework.dart:3497:11)
I/flutter (17893): #1 Element.markNeedsBuild (package:flutter/src/widgets/framework.dart:3523:6)
I/flutter (17893): #2 State.setState (package:flutter/src/widgets/framework.dart:1138:14)
I/flutter (17893): #3 OverlayState.insertAll (package:flutter/src/widgets/overlay.dart:301:5)
I/flutter (17893): #4 OverlayRoute.install (package:flutter/src/widgets/routes.dart:43:24)
I/flutter (17893): #5 TransitionRoute.install (package:flutter/src/widgets/routes.dart:184:11)
I/flutter (17893): #6 ModalRoute.install (package:flutter/src/widgets/routes.dart:899:11)
I/flutter (17893): #7 NavigatorState.push (package:flutter/src/widgets/navigator.dart:1672:11)
I/flutter (17893): #8 Navigator.push (package:flutter/src/widgets/navigator.dart:1011:34)
I/flutter (17893): #9 _SetPinPageState.submitButton (package:technicalreport/screens/set_pin_page.dart:94:15)
I/flutter (17893): #10 _SetPinPageState.build.<anonymous closure>.<anonymous closure> (package:technicalreport/screens/set_pin_page.dart:52:29)
I/flutter (17893): #11 OrientationBuilder._buildWithConstraints (package:flutter/src/widgets/orientation_builder.dart:48:12)
I/flutter (17893): #12 _LayoutBuilderElement._layout.<anonymous closure> (package:flutter/src/widgets/layout_builder.dart:111:26)
I/flutter (17893): #13 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2253:19)
I/flutter (17893): #14 _LayoutBuilderElement._layout (package:flutter/src/widgets/layout_builder.dart:107:11)
I/flutter (17893): #15 RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:1728:58)
I/flutter (17893): #16 PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:797:15)
I/flutter (17893): #17 RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:1728:13)
I/flutter (17893): #18 _RenderLayoutBuilder.performLayout (package:flutter/src/widgets/layout_builder.dart:205:5)
I/flutter (17893): #19 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #20 MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:142:11)
I/flutter (17893): #21 _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:350:7)
I/flutter (17893): #22 MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:212:7)
I/flutter (17893): #23 RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:356:14)
I/flutter (17893): #24 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #25 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #26 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #27 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #28 _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1206:11)
I/flutter (17893): #29 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #30 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #31 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #32 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #33 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #34 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #35 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #36 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #37 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #38 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #39 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #40 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #41 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #42 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #43 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #44 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #45 RenderOffstage.performLayout (package:flutter/src/rendering/proxy_box.dart:3032:13)
I/flutter (17893): #46 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #47 RenderStack.performLayout (package:flutter/src/rendering/stack.dart:510:15)
I/flutter (17893): #48 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #49 __RenderTheatre&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #50 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #51 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #52 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #53 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #54 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #55 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #56 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #57 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105:13)
I/flutter (17893): #58 RenderObject.layout (package:flutter/src/rendering/object.dart:1632:7)
I/flutter (17893): #59 RenderView.performLayout (package:flutter/src/rendering/view.dart:151:13)
I/flutter (17893): #60 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1507:7)
I/flutter (17893): #61 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:766:18)
I/flutter (17893): #62 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:329:19)
I/flutter (17893): #63 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:701:13)
I/flutter (17893): #64 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:268:5)
I/flutter (17893): #65 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:988:15)
I/flutter (17893): #66 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:928:9)
I/flutter (17893): #67 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:749:7)
I/flutter (17893): #76 _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)
I/flutter (17893): #77 _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)
I/flutter (17893): #78 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
I/flutter (17893): (elided 8 frames from package dart:async)
I/flutter (17893): ════════════════════════════════════════════════════════════════════════════════════════════════════
D/ (17893): HostConnection::get() New Host Connection established 0xa0ba6b40, tid 17931
D/EGL_emulation(17893): eglMakeCurrent: 0xa3508c40: ver 2 0 (tinfo 0x9084ab40)
There are three callbacks available in flutter which rendering flutter widgets.
Transient callbacks: triggered by the system’s [Window.onBeginFrame] callback, for synchronizing the application’s behavior to the system’s display. For example, [Ticker]s and [AnimationController]s trigger from these.
Persistent callbacks: triggered by the system’s [Window.onDrawFrame] callback, for updating the system’s display after transient callbacks have executed. For example, the rendering layer uses this to drive its rendering pipeline.
Post-frame callbacks: which are run after persistent callbacks, just before returning from the [Window.onDrawFrame] callback. * Non-rendering tasks, to be run between frames. These are given a priority and are executed in priority order according to a schedulingStrategy.
All above callbacks run sequentially, but for us, the last callback would work i.e Post-frame callbacks
Widgets Binding: The glue between the widgets layer and the Flutter engine. which comes with WidgetsBindingObserver mixin which has many callbacks but one which required to use is didChangeAppLifecycleState that returns AppLifecycleState.
Scheduler Binding: This is also similar to WidgetBinding but it does not provide any life cycle callbacks.
The below binding example would be called exactly the ones, means print statement like WidgetsBinding & SchedulerBinding will be printed only once as we called it initState(), but it will be called when build method finished it’s rendering.
void initState() {
super.initState();
print("initState");
WidgetsBinding.instance.addPostFrameCallback((_) {
print("WidgetsBinding");
});
SchedulerBinding.instance.addPostFrameCallback((_) {
print("SchedulerBinding");
});
}
Both solutions do the same.
WidgetsBinding inherits this Method from SchedulerBinding
https://api.flutter.dev/flutter/widgets/WidgetsBinding-mixin.html
It registers a callback that will be called after the frame is build.
See in the docs:
https://api.flutter.dev/flutter/scheduler/SchedulerBinding/addPostFrameCallback.html
I want to have a dialog that takes my user through an authentication flow. It will need the following widgets:
Choose auth method (Google, Facebook, email, phone, etc)
Enter email address
Enter phone number
Enter code from (email/phone)
What I'm trying to do is create an AlertDialog with a PageView widget that will be navigated via the PageController (I have set physics: NeverScrollableScrollPhysics() to prevent the user from scrolling around). The whole idea here is I'd like the dialog to always remain the same size (which I understand PageView will measure all the children and should allow me to do this.
I tried creating the PageView with 3 Text widgets and I get the following error:
I/flutter (16052): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter (16052): The following assertion was thrown during performLayout():
I/flutter (16052): RenderViewport does not support returning intrinsic dimensions.
I/flutter (16052): Calculating the intrinsic dimensions would require instantiating every child of the viewport, which
I/flutter (16052): defeats the point of viewports being lazy.
I/flutter (16052): If you are merely trying to shrink-wrap the viewport in the main axis direction, consider a
I/flutter (16052): RenderShrinkWrappingViewport render object (ShrinkWrappingViewport widget), which achieves that
I/flutter (16052): effect without implementing the intrinsic dimension API.
I/flutter (16052):
I/flutter (16052): When the exception was thrown, this was the stack:
I/flutter (16052): #0 RenderViewportBase.debugThrowIfNotCheckingIntrinsics.<anonymous closure> (package:flutter/src/rendering/viewport.dart:299:9)
I/flutter (16052): #1 RenderViewportBase.debugThrowIfNotCheckingIntrinsics (package:flutter/src/rendering/viewport.dart:309:6)
I/flutter (16052): #2 RenderViewportBase.computeMaxIntrinsicWidth (package:flutter/src/rendering/viewport.dart:321:12)
I/flutter (16052): #3 RenderBox._computeIntrinsicDimension.<anonymous closure> (package:flutter/src/rendering/box.dart:1099:23)
I/flutter (16052): #4 __InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection/runtime/libcompact_hash.dart:284:23)
I/flutter (16052): #5 RenderBox._computeIntrinsicDimension (package:flutter/src/rendering/box.dart:1097:41)
I/flutter (16052): #6 RenderBox.getMaxIntrinsicWidth (package:flutter/src/rendering/box.dart:1281:12)
I/flutter (16052): #7 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.computeMaxIntrinsicWidth (package:flutter/src/rendering/proxy_box.dart:76:20)
I/flutter (16052): #8 RenderBox._computeIntrinsicDimension.<anonymous closure> (package:flutter/src/rendering/box.dart:1099:23)
I/flutter (16052): #9 __InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection/runtime/libcompact_hash.dart:284:23)
I/flutter (16052): #10 RenderBox._computeIntrinsicDimension (package:flutter/src/rendering/box.dart:1097:41)
I/flutter (16052): #11 RenderBox.getMaxIntrinsicWidth (package:flutter/src/rendering/box.dart:1281:12)
I/flutter (16052): #12 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.computeMaxIntrinsicWidth (package:flutter/src/rendering/proxy_box.dart:76:20)
I/flutter (16052): #13 RenderBox._computeIntrinsicDimension.<anonymous closure> (package:flutter/src/rendering/box.dart:1099:23)
I/flutter (16052): #14 __InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection/runtime/libcompact_hash.dart:284:23)
I/flutter (16052): #15 RenderBox._computeIntrinsicDimension (package:flutter/src/rendering/box.dart:1097:41)
I/flutter (16052): #16 RenderBox.getMaxIntrinsicWidth (package:flutter/src/rendering/box.dart:1281:12)
I/flutter (16052): #17 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.computeMaxIntrinsicWidth (package:flutter/src/rendering/proxy_box.dart:76:20)
I/flutter (16052): #18 RenderBox._computeIntrinsicDimension.<anonymous closure> (package:flutter/src/rendering/box.dart:1099:23)
I/flutter (16052): #19 __InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection/runtime/libcompact_hash.dart:284:23)
I/flutter (16052): #20 RenderBox._computeIntrinsicDimension (package:flutter/src/rendering/box.dart:1097:41)
I/flutter (16052): #21 RenderBox.getMaxIntrinsicWidth (package:flutter/src/rendering/box.dart:1281:12)
I/flutter (16052): #22 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.computeMaxIntrinsicWidth (package:flutter/src/rendering/proxy_box.dart:76:20)
I/flutter (16052): #23 RenderBox._computeIntrinsicDimension.<anonymous closure> (package:flutter/src/rendering/box.dart:1099:23)
I/flutter (16052): #24 __InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection/runtime/libcompact_hash.dart:284:23)
I/flutter (16052): #25 RenderBox._computeIntrinsicDimension (package:flutter/src/rendering/box.dart:1097:41)
I/flutter (16052): #26 RenderBox.getMaxIntrinsicWidth (package:flutter/src/rendering/box.dart:1281:12)
I/flutter (16052): #27 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.computeMaxIntrinsicWidth (package:flutter/src/rendering/proxy_box.dart:76:20)
I/flutter (16052): #28 RenderBox._computeIntrinsicDimension.<anonymous closure> (package:flutter/src/rendering/box.dart:1099:23)
I/flutter (16052): #29 __InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection/runtime/libcompact_hash.dart:284:23)
I/flutter (16052): #30 RenderBox._computeIntrinsicDimension (package:flutter/src/rendering/box.dart:1097:41)
I/flutter (16052): #31 RenderBox.getMaxIntrinsicWidth (package:flutter/src/rendering/box.dart:1281:12)
I/flutter (16052): #32 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.computeMaxIntrinsicWidth (package:flutter/src/rendering/proxy_box.dart:76:20)
I/flutter (16052): #33 RenderBox._computeIntrinsicDimension.<anonymous closure> (package:flutter/src/rendering/box.dart:1099:23)
I/flutter (16052): #34 __InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection/runtime/libcompact_hash.dart:284:23)
I/flutter (16052): #35 RenderBox._computeIntrinsicDimension (package:flutter/src/rendering/box.dart:1097:41)
I/flutter (16052): #36 RenderBox.getMaxIntrinsicWidth (package:flutter/src/rendering/box.dart:1281:12)
I/flutter (16052): #37 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.computeMaxIntrinsicWidth (package:flutter/src/rendering/proxy_box.dart:76:20)
I/flutter (16052): #38 RenderBox._computeIntrinsicDimension.<anonymous closure> (package:flutter/src/rendering/box.dart:1099:23)
I/flutter (16052): #39 __InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection/runtime/libcompact_hash.dart:284:23)
I/flutter (16052): #40 RenderBox._computeIntrinsicDimension (package:flutter/src/rendering/box.dart:1097:41)
I/flutter (16052): #41 RenderBox.getMaxIntrinsicWidth (package:flutter/src/rendering/box.dart:1281:12)
I/flutter (16052): #42 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.computeMaxIntrinsicWidth (package:flutter/src/rendering/proxy_box.dart:76:20)
I/flutter (16052): #43 RenderBox._computeIntrinsicDimension.<anonymous closure> (package:flutter/src/rendering/box.dart:1099:23)
I/flutter (16052): #44 __InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection/runtime/libcompact_hash.dart:284:23)
I/flutter (16052): #45 RenderBox._computeIntrinsicDimension (package:flutter/src/rendering/box.dart:1097:41)
I/flutter (16052): #46 RenderBox.getMaxIntrinsicWidth (package:flutter/src/rendering/box.dart:1281:12)
I/flutter (16052): #47 RenderPadding.computeMaxIntrinsicWidth (package:flutter/src/rendering/shifted_box.dart:163:20)
I/flutter (16052): #48 RenderBox._computeIntrinsicDimension.<anonymous closure> (package:flutter/src/rendering/box.dart:1099:23)
I/flutter (16052): #49 __InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection/runtime/libcompact_hash.dart:284:23)
I/flutter (16052): #50 RenderBox._computeIntrinsicDimension (package:flutter/src/rendering/box.dart:1097:41)
I/flutter (16052): #51 RenderBox.getMaxIntrinsicWidth (package:flutter/src/rendering/box.dart:1281:12)
I/flutter (16052): #52 RenderFlex.computeMaxIntrinsicWidth.<anonymous closure> (package:flutter/src/rendering/flex.dart:575:60)
I/flutter (16052): #53 RenderFlex._getIntrinsicSize (package:flutter/src/rendering/flex.dart:552:58)
I/flutter (16052): #54 RenderFlex.computeMaxIntrinsicWidth (package:flutter/src/rendering/flex.dart:572:12)
I/flutter (16052): #55 RenderBox._computeIntrinsicDimension.<anonymous closure> (package:flutter/src/rendering/box.dart:1099:23)
I/flutter (16052): #56 __InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.putIfAbsent (dart:collection/runtime/libcompact_hash.dart:284:23)
I/flutter (16052): #57 RenderBox._computeIntrinsicDimension (package:flutter/src/rendering/box.dart:1097:41)
I/flutter (16052): #58 RenderBox.getMaxIntrinsicWidth (package:flutter/src/rendering/box.dart:1281:12)
I/flutter (16052): #59 RenderIntrinsicWidth.performLayout (package:flutter/src/rendering/proxy_box.dart:617:36)
I/flutter (16052): #60 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter (16052): #61 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter (16052): #62 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter (16052): #63 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter (16052): #64 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter (16052): #65 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter (16052): #66 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter (16052): #67 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter (16052): #68 _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1188:11)
I/flutter (16052): #69 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter (16052): #70 RenderConstrainedBox.performLayout (package:flutter/src/rendering/proxy_box.dart:258:13)
I/flutter (16052): #71 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter (16052): #72 RenderPositionedBox.performLayout (package:flutter/src/rendering/shifted_box.dart:385:13)
I/flutter (16052): #73 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter (16052): #74 RenderPadding.performLayout (package:flutter/src/rendering/shifted_box.dart:199:11)
I/flutter (16052): #75 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter (16052): #76 RenderPadding.performLayout (package:flutter/src/rendering/shifted_box.dart:199:11)
I/flutter (16052): #77 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter (16052): #78 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter (16052): #79 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter (16052): #80 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter (16052): #81 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter (16052): #82 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter (16052): #83 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter (16052): #84 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter (16052): #85 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter (16052): #86 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter (16052): #87 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter (16052): #88 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter (16052): #89 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter (16052): #90 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter (16052): #91 RenderOffstage.performLayout (package:flutter/src/rendering/proxy_box.dart:2881:13)
I/flutter (16052): #92 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter (16052): #93 RenderStack.performLayout (package:flutter/src/rendering/stack.dart:510:15)
I/flutter (16052): #94 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1509:7)
I/flutter (16052): #95 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:768:18)
I/flutter (16052): #96 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:281:19)
I/flutter (16052): #97 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:677:13)
I/flutter (16052): #98 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:219:5)
I/flutter (16052): #99 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:990:15)
I/flutter (16052): #100 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:930:9)
I/flutter (16052): #101 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:842:5)
I/flutter (16052): #102 _invoke (dart:ui/hooks.dart:154:13)
I/flutter (16052): #103 _drawFrame (dart:ui/hooks.dart:143:3)
I/flutter (16052):
I/flutter (16052): The following RenderObject was being processed when the exception was fired:
I/flutter (16052): RenderIntrinsicWidth#88cfa relayoutBoundary=up6 NEEDS-LAYOUT NEEDS-PAINT
I/flutter (16052): creator: IntrinsicWidth ← Semantics ← DefaultTextStyle ← AnimatedDefaultTextStyle ←
I/flutter (16052): _InkFeatures-[GlobalKey#8e5bb ink renderer] ← NotificationListener<LayoutChangedNotification> ←
I/flutter (16052): CustomPaint ← _ShapeBorderPaint ← PhysicalShape ← _MaterialInterior ← Material ← ConstrainedBox ←
I/flutter (16052): ⋯
I/flutter (16052): parentData: <none> (can use size)
I/flutter (16052): constraints: BoxConstraints(280.0<=w<=331.4, 0.0<=h<=611.4)
I/flutter (16052): size: MISSING
I/flutter (16052): stepWidth: null
I/flutter (16052): stepHeight: null
I/flutter (16052): This RenderObject had the following descendants (showing up to depth 5):
I/flutter (16052): RenderFlex#1cdae NEEDS-LAYOUT NEEDS-PAINT
I/flutter (16052): RenderPadding#3c952 NEEDS-LAYOUT NEEDS-PAINT
I/flutter (16052): RenderRepaintBoundary#2e299 NEEDS-LAYOUT NEEDS-PAINT
I/flutter (16052): RenderCustomPaint#4dd7f NEEDS-LAYOUT NEEDS-PAINT
I/flutter (16052): RenderRepaintBoundary#ebf6b NEEDS-LAYOUT NEEDS-PAINT
I/flutter (16052): RenderPadding#31e20 NEEDS-LAYOUT NEEDS-PAINT
I/flutter (16052): RenderFlex#8072a NEEDS-LAYOUT NEEDS-PAINT
I/flutter (16052): RenderPadding#a5f11 NEEDS-LAYOUT NEEDS-PAINT
I/flutter (16052): RenderSemanticsAnnotations#f63f2 NEEDS-LAYOUT NEEDS-PAINT
I/flutter (16052): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter (16052): Another exception was thrown: RenderBox was not laid out: RenderIntrinsicWidth#88cfa relayoutBoundary=up6 NEEDS-PAINT
I/flutter (16052): Another exception was thrown: RenderBox was not laid out: RenderSemanticsAnnotations#ca67f relayoutBoundary=up5 NEEDS-PAINT
I/flutter (16052): Another exception was thrown: RenderBox was not laid out: _RenderInkFeatures#a2ca4 relayoutBoundary=up4 NEEDS-PAINT
I/flutter (16052): Another exception was thrown: RenderBox was not laid out: RenderCustomPaint#b4d9b relayoutBoundary=up3 NEEDS-PAINT
I/flutter (16052): Another exception was thrown: RenderBox was not laid out: RenderPhysicalShape#235a2 relayoutBoundary=up2 NEEDS-PAINT
I/flutter (16052): Another exception was thrown: 'package:flutter/src/rendering/shifted_box.dart': Failed assertion: line 314 pos 12: 'child.hasSize': is not true.
I/flutter (16052): Another exception was thrown: RenderBox was not laid out: RenderPhysicalShape#235a2 relayoutBoundary=up2
If there's a better way to do this, I'm open to it as long as the dialog won't resize.
UPDATE:
Here's a minimal sample, simply launch the following dialog:
AlertDialog(
content: PageView(
children: <Widget> [
Text('child1'),
Text('child2'),
Text('child3'),
],
),
);
The problem appears that PageView doesn't instantiate all the views right away but does it lazily to save CPU cycles. This means that AlertDialog can't size itself. I'm trying to figure out if there's a way to override PageView's default behavior and have it measure its size right away maybe?
UPDATE:
While I haven't been able to do anything with PageView I've been able to mimic the behavior I want with a simple IndexedStack. It just lacks the animations when programmatically moving between pages, but hopefully I'll be able to add that in. I'll post a final answer once finished.
Just wrap your PageView with a Container and specify its width and height will do the work.
AlertDialog(
Container(
width: width,
height: height,
child: PageView(
...
),
),
)
I need to create table which contains numbers and has square form.
The obvious solution would be to use widget Table, but...
When I use odd size it works, when I use even size it fails with rendering exception.
How to fix it?
void main() => runApp(
MaterialApp(
home: Scaffold(
appBar: new AppBar(title: Text("Table Shulte")),
body: tab(),
)
)
);
Widget tab(){
int N = 6;
Widget table = Table(
children: List.generate(N, (i){
return TableRow(children: List.generate(N, (j) =>
AspectRatio(child:Center(child: Text("${i*N+j+1}", textScaleFactor: 12.0/N,)), aspectRatio: 1.0,)
));
}),
border: TableBorder.all(),
);
return table;
}
I don't understand why this assert failes:
'package:flutter/src/rendering/table.dart': Failed assertion: line 883 pos 16: 'tableWidth >= targetWidth': is not true.
Another exception was thrown: 'package:flutter/src/rendering/table.dart': Failed assertion: line 1126 pos 12: '_rowTops.length == rows + 1': is not true.
Here the log.
I/flutter (10304): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter (10304): The following assertion was thrown during performLayout():
I/flutter (10304): 'package:flutter/src/rendering/table.dart': Failed assertion: line 883 pos 16: 'tableWidth >=
I/flutter (10304): targetWidth': is not true.
I/flutter (10304): When the exception was thrown, this was the stack:
I/flutter (10304): #2 RenderTable._computeColumnWidths (package:flutter/src/rendering/table.dart)
I/flutter (10304): #3 RenderTable.performLayout (package:flutter/src/rendering/table.dart:1001:33)
I/flutter (10304): #4 RenderObject.layout (package:flutter/src/rendering/object.dart:1570:7)
I/flutter (10304): #5 MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:141:11)
I/flutter (10304): #6 _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:399:7)
I/flutter (10304): #7 MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:211:7)
I/flutter (10304): #8 RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:355:14)
I/flutter (10304): #9 RenderObject.layout (package:flutter/src/rendering/object.dart:1570:7)
I/flutter (10304): #10 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:109:13)
I/flutter (10304): #11 RenderObject.layout (package:flutter/src/rendering/object.dart:1570:7)
I/flutter (10304): #12 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:109:13)
I/flutter (10304): #13 _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1143:11)
I/flutter (10304): #14 RenderObject.layout (package:flutter/src/rendering/object.dart:1570:7)
I/flutter (10304): #15 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:109:13)
I/flutter (10304): #16 RenderObject.layout (package:flutter/src/rendering/object.dart:1570:7)
I/flutter (10304): #17 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:109:13)
I/flutter (10304): This RenderObject had the following descendants (showing up to depth 5):
I/flutter (10304): RenderAspectRatio#eecef NEEDS-LAYOUT NEEDS-PAINT
I/flutter (10304): RenderPositionedBox#1f1ff NEEDS-LAYOUT NEEDS-PAINT
I/flutter (10304): RenderParagraph#8f8f7 NEEDS-LAYOUT NEEDS-PAINT
I/flutter (10304): Another exception was thrown: RenderBox was not laid out: RenderTable#babed relayoutBoundary=up1 NEEDS-PAINT
I/flutter (10304): Another exception was thrown: 'package:flutter/src/rendering/table.dart': Failed assertion: line 1126 pos 12: '_rowTops.length == rows + 1': is not true.
The problem causing the issue is textScaleFactor.
List.generate(index,...) method starts the index from (0).
When we call the textScaleFactor: 12.0/N is not returning a number for the widget therefore it causes an issue.
I simply, modified your tab method as follows and it returns a view now.
Widget tab(){
int N = 6;
Widget table = Table(
children: List.generate(N, (i){
return TableRow(children: List.generate(N+1, (j) =>
AspectRatio(child:Center(child: Text("${i*N+j+1}", textScaleFactor: 12.0/N)), aspectRatio: 1.0)
));
}),
border: TableBorder.all(),
);
return table;
}