GaspardMerten / flutter_auto_form

A package simplifying the process of creating user friendly forms in Flutter
MIT License
26 stars 3 forks source link

Putting AFWidget inside a Row/Column throws render errors #4

Closed stiggy87 closed 3 years ago

stiggy87 commented 3 years ago

Not sure why it is doing this, I have a bunch of fields I want to add with some Text() widgets above it to explain things.

Here's the log:

''' Restarted application in 301ms. Restarted application in 312ms.

════════ Exception caught by rendering library ═════════════════════════════════ The following assertion was thrown during performLayout(): Assertion failed: layoutConstraints.maxWidth < double.infinity "An InputDecorator, which is typically created by a TextField, cannot have an unbounded width.\nThis happens when the parent widget does not provide a finite width constraint. For example, if the InputDecorator is contained by a Row, then its width must be constrained. An Expanded widget or a SizedBox can be used to constrain the width of the InputDecorator or the TextField that contains it."

The relevant error-causing widget was TextFormField When the exception was thrown, this was the stack C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddcruntime/errors.dart 251:49 throw C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 29:3 assertFailed packages/flutter/src/material/input_decorator.dart 959:24 [_layout] packages/flutter/src/material/input_decorator.dart 1342:44 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/proxy_box.dart 116:7 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/proxy_box.dart 116:7 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/proxy_box.dart 116:7 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/proxy_box.dart 116:7 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/proxy_box.dart 116:7 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/shifted_box.dart 233:5 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/layout_helper.dart 56:10 layoutChild packages/flutter/src/rendering/flex.dart 829:43 [_computeSizes] packages/flutter/src/rendering/flex.dart 931:32 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/shifted_box.dart 233:5 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/shifted_box.dart 233:5 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/layout_helper.dart 56:10 layoutChild packages/flutter/src/rendering/flex.dart 829:43 [_computeSizes] packages/flutter/src/rendering/flex.dart 931:32 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/shifted_box.dart 437:7 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/layout_helper.dart 56:10 layoutChild packages/flutter/src/rendering/flex.dart 896:45 [_computeSizes] packages/flutter/src/rendering/flex.dart 931:32 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/custom_layout.dart 171:10 layoutChild packages/flutter/src/material/scaffold.dart 1005:7 performLayout packages/flutter/src/rendering/custom_layout.dart 240:7 [_callPerformLayout] packages/flutter/src/rendering/custom_layout.dart 403:14 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/proxy_box.dart 116:7 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/proxy_box.dart 116:7 performLayout packages/flutter/src/rendering/proxy_box.dart 1376:11 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/proxy_box.dart 116:7 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/proxy_box.dart 116:7 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/proxy_box.dart 116:7 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/proxy_box.dart 116:7 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/proxy_box.dart 116:7 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/proxy_box.dart 116:7 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/proxy_box.dart 116:7 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/proxy_box.dart 116:7 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/proxy_box.dart 116:7 performLayout packages/flutter/src/rendering/proxy_box.dart 3428:13 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/proxy_box.dart 116:7 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/widgets/overlay.dart 751:14 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/proxy_box.dart 116:7 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/proxy_box.dart 116:7 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/proxy_box.dart 116:7 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/proxy_box.dart 116:7 performLayout packages/flutter/src/rendering/custom_paint.dart 545:11 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/proxy_box.dart 116:7 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/proxy_box.dart 116:7 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/proxy_box.dart 116:7 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/proxy_box.dart 116:7 performLayout packages/flutter/src/rendering/object.dart 1855:7 layout packages/flutter/src/rendering/view.dart 165:7 performLayout packages/flutter/src/rendering/object.dart 1710:7 [_layoutWithoutResize] packages/flutter/src/rendering/object.dart 882:17 flushLayout packages/flutter/src/rendering/binding.dart 483:19 drawFrame packages/flutter/src/widgets/binding.dart 883:13 drawFrame packages/flutter/src/rendering/binding.dart 349:5 [_handlePersistentFrameCallback] packages/flutter/src/scheduler/binding.dart 1145:15 [_invokeFrameCallback] packages/flutter/src/scheduler/binding.dart 1082:9 handleDrawFrame packages/flutter/src/scheduler/binding.dart 863:7 C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/isolate_helper.dart 48:19 internalCallback The following RenderObject was being processed when the exception was fired: _RenderDecoration#65b0c relayoutBoundary=up13 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE RenderObject: _RenderDecoration#65b0c relayoutBoundary=up13 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE parentData: (can use size) constraints: BoxConstraints(unconstrained) size: MISSING input: RenderRepaintBoundary#1b320 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE needs compositing parentData: offset=Offset(0.0, 0.0) constraints: MISSING size: MISSING usefulness ratio: no metrics collected yet (never painted) child: RenderMouseRegion#62e4f NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE parentData: constraints: MISSING size: MISSING listeners: child: RenderPointerListener#bedd5 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE parentData: constraints: MISSING size: MISSING behavior: deferToChild listeners: signal child: RenderPointerListener#16954 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE parentData: constraints: MISSING size: MISSING behavior: opaque listeners: down label: RenderTransform#2aedb NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE parentData: offset=Offset(0.0, 0.0) constraints: MISSING size: MISSING transform matrix: [0] 1.0,0.0,0.0,-0.0 [1] 0.0,1.0,0.0,0.0 [2] 0.0,0.0,1.0,0.0 [3] 0.0,0.0,0.0,1.0 origin: null alignment: null textDirection: ltr transformHitTests: true child: RenderAnimatedOpacity#f242b NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE parentData: constraints: MISSING size: MISSING opacity: AnimationController#de7b8(⏮ 0.000; paused; for AnimatedOpacity)➩Cubic(0.40, 0.00, 0.20, 1.00)➩Tween(1 → null)➩1 child: RenderParagraph#b4621 NEEDS-LAYOUT NEEDS-PAINT parentData: constraints: MISSING size: MISSING textAlign: start textDirection: ltr softWrap: wrapping at box width overflow: ellipsis locale: en_US maxLines: unlimited text: TextSpan debugLabel: ((((englishLike subhead 2014).merge((whiteRedmond subtitle1).merge(unknown))).copyWith).merge(unknown)).copyWith inherit: false color: Color(0xffffffff) family: Segoe UI size: 16.0 weight: 400 style: normal baseline: alphabetic height: 1.0x decoration: TextDecoration.none "Name" helperError: RenderConstrainedBox#13d1f NEEDS-LAYOUT NEEDS-PAINT parentData: offset=Offset(0.0, 0.0) constraints: MISSING size: MISSING additionalConstraints: BoxConstraints(unconstrained) container: RenderCustomPaint#97ce7 NEEDS-LAYOUT NEEDS-PAINT parentData: offset=Offset(0.0, 0.0) constraints: MISSING size: MISSING ════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════ Assertion failed: hasSize "RenderBox was not laid out: _RenderDecoration#65b0c relayoutBoundary=up13 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE"

The relevant error-causing widget was TextFormField ════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════ Assertion failed: hasSize "RenderBox was not laid out: RenderPointerListener#c7ffb relayoutBoundary=up12 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE"

The relevant error-causing widget was TextFormField ════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════ Assertion failed: hasSize "RenderBox was not laid out: RenderSemanticsAnnotations#d761c relayoutBoundary=up11 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE"

The relevant error-causing widget was TextFormField ════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════ Assertion failed: hasSize "RenderBox was not laid out: RenderIgnorePointer#9e4c7 relayoutBoundary=up10 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE"

The relevant error-causing widget was TextFormField ════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════ Assertion failed: hasSize "RenderBox was not laid out: RenderMouseRegion#b381c relayoutBoundary=up9 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE"

The relevant error-causing widget was TextFormField ════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════ Assertion failed: hasSize "RenderBox was not laid out: _RenderFocusTrapArea#49e22 relayoutBoundary=up8 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE"

The relevant error-causing widget was Padding ════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════ Assertion failed: hasSize "RenderBox was not laid out: RenderPadding#658f9 relayoutBoundary=up7 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE"

The relevant error-causing widget was Column ════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════ Assertion failed: hasSize "RenderBox was not laid out: RenderFlex#adaf3 relayoutBoundary=up6 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE"

The relevant error-causing widget was Container ════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════ Assertion failed: hasSize "RenderBox was not laid out: RenderPadding#069b0 relayoutBoundary=up5 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE"

The relevant error-causing widget was Container ════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════ Assertion failed: hasSize "RenderBox was not laid out: RenderPadding#7c3f5 relayoutBoundary=up4 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE"

The relevant error-causing widget was Row ════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════ Assertion failed: child!.hasSize is not true

The relevant error-causing widget was Center ════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════ Assertion failed: hasSize "RenderBox was not laid out: RenderTransform#2aedb NEEDS-LAYOUT NEEDS-PAINT"

The relevant error-causing widget was TextFormField ════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════ Assertion failed: hasSize "RenderBox was not laid out: RenderTransform#2aedb NEEDS-LAYOUT NEEDS-PAINT"

The relevant error-causing widget was AFWidget ════════════════════════════════════════════════════════════════════════════════ '''

stiggy87 commented 3 years ago

I do want to note that the RenderFlex widget used has the size missing, which looks like it's causing the problem.

GaspardMerten commented 3 years ago

Hello,

Could you give me a simple code example that triggers the issue?

From what you are saying, it looks like your widget structure is the problem, not the flutter auto form package but let's be sure!

stiggy87 commented 3 years ago

Did some testing, due to another package, I used an Expanded with no flex. When I set it to a flex of 2, and things started rendering properly. Looks like this other 3rd party package caused issues.