Is there a way to create an AlertDialog with PageView in Flutter?












0















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.










share|improve this question

























  • Share your code !

    – anmol.majhail
    Jan 3 at 3:40
















0















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.










share|improve this question

























  • Share your code !

    – anmol.majhail
    Jan 3 at 3:40














0












0








0








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.










share|improve this question
















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.







flutter






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 3 at 18:48







TheHebrewHammer

















asked Jan 2 at 19:58









TheHebrewHammerTheHebrewHammer

1,2401923




1,2401923













  • Share your code !

    – anmol.majhail
    Jan 3 at 3:40



















  • Share your code !

    – anmol.majhail
    Jan 3 at 3:40

















Share your code !

– anmol.majhail
Jan 3 at 3:40





Share your code !

– anmol.majhail
Jan 3 at 3:40












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54012407%2fis-there-a-way-to-create-an-alertdialog-with-pageview-in-flutter%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54012407%2fis-there-a-way-to-create-an-alertdialog-with-pageview-in-flutter%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

generate and download xml file after input submit (php and mysql) - JPK

Angular Downloading a file using contenturl with Basic Authentication

Can't read property showImagePicker of undefined in react native iOS