Skip to content

Instantly share code, notes, and snippets.

@RaminNietzsche
Created February 23, 2019 08:40
Show Gist options
  • Save RaminNietzsche/3f282614d89223957072f746a3b235c3 to your computer and use it in GitHub Desktop.
Save RaminNietzsche/3f282614d89223957072f746a3b235c3 to your computer and use it in GitHub Desktop.
import 'dart:convert';
import 'package:flutter/material.dart';
class FormGen extends StatefulWidget{
@override
State<StatefulWidget> createState() => _FormGen();
}
class _FormGen extends State<FormGen> {
String formJson = '''
{
"form": "khatm",
"fields": [{
"name": "username",
"type": "text",
"validator": "name",
"options": null,
"requierd": true
}]
}
''';
List<Widget> formWidget = [];
@override
void initState() {
// TODO: implement initState
super.initState();
}
@override
Widget build(BuildContext context) {
List formList;
var js = jsonDecode(formJson);
js['fields'].forEach((element) {
if (element["type"] == "text")
this.formWidget.add(
new TextField(
)
);
});
print(formList);
return Scaffold(
body: Row(
children: this.formWidget,
),
);
}
}
class FormMaker {
String name;
String type;
String validator;
List options;
bool required;
FormMaker(
{
this.name,
this.type,
this.validator,
this.options,
this.required
}
);
factory FormMaker.fromJson(Map<String, dynamic> json){
print(json);
return new FormMaker(
name: json['name'],
type: json['type'],
validator: json['validator'],
options: json['options'],
required: json['required'],
);
}
}
@RaminNietzsche
Copy link
Author

I/flutter ( 6261): The following assertion was thrown during performLayout():
I/flutter ( 6261): BoxConstraints forces an infinite width.
I/flutter ( 6261): These invalid constraints were provided to RenderRepaintBoundary's layout() function by the
I/flutter ( 6261): following function, which probably computed the invalid constraints in question:
I/flutter ( 6261): _RenderDecoration._layout.layoutLineBox (package:flutter/src/material/input_decorator.dart:815:11)
I/flutter ( 6261): The offending constraints were:
I/flutter ( 6261): BoxConstraints(w=Infinity, 0.0<=h<=401.1)
I/flutter ( 6261):
I/flutter ( 6261): When the exception was thrown, this was the stack:
I/flutter ( 6261): #0 BoxConstraints.debugAssertIsValid..throwError (package:flutter/src/rendering/box.dart:504:9)
I/flutter ( 6261): #1 BoxConstraints.debugAssertIsValid. (package:flutter/src/rendering/box.dart:545:21)
I/flutter ( 6261): #2 BoxConstraints.debugAssertIsValid (package:flutter/src/rendering/box.dart:551:6)
I/flutter ( 6261): #3 RenderObject.layout (package:flutter/src/rendering/object.dart:1549:24)
I/flutter ( 6261): #4 _RenderDecoration._layout.layoutLineBox (package:flutter/src/material/input_decorator.dart:815:11)
I/flutter ( 6261): #5 _RenderDecoration._layout (package:flutter/src/material/input_decorator.dart:847:18)
I/flutter ( 6261): #6 _RenderDecoration.performLayout (package:flutter/src/material/input_decorator.dart:976:44)
I/flutter ( 6261): #7 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter ( 6261): #8 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter ( 6261): #9 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter ( 6261): #10 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter ( 6261): #11 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter ( 6261): #12 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter ( 6261): #13 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter ( 6261): #14 RenderFlex.performLayout (package:flutter/src/rendering/flex.dart:738:15)
I/flutter ( 6261): #15 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter ( 6261): #16 MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:142:11)
I/flutter ( 6261): #17 _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:339:7)
I/flutter ( 6261): #18 MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:212:7)
I/flutter ( 6261): #19 RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:356:14)
I/flutter ( 6261): #20 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter ( 6261): #21 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter ( 6261): #22 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter ( 6261): #23 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter ( 6261): #24 _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1188:11)
I/flutter ( 6261): #25 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter ( 6261): #26 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter ( 6261): #27 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter ( 6261): #28 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter ( 6261): #29 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter ( 6261): #30 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter ( 6261): #31 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter ( 6261): #32 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter ( 6261): #33 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter ( 6261): #34 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter ( 6261): #35 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter ( 6261): #36 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter ( 6261): #37 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter ( 6261): #38 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter ( 6261): #39 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter ( 6261): #40 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter ( 6261): #41 RenderOffstage.performLayout (package:flutter/src/rendering/proxy_box.dart:2881:13)
I/flutter ( 6261): #42 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter ( 6261): #43 RenderStack.performLayout (package:flutter/src/rendering/stack.dart:510:15)
I/flutter ( 6261): #44 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter ( 6261): #45 __RenderTheatre&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter ( 6261): #46 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter ( 6261): #47 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter ( 6261): #48 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter ( 6261): #49 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter ( 6261): #50 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter ( 6261): #51 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter ( 6261): #52 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter ( 6261): #53 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter ( 6261): #54 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter ( 6261): #55 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:104:13)
I/flutter ( 6261): #56 RenderObject.layout (package:flutter/src/rendering/object.dart:1634:7)
I/flutter ( 6261): #57 RenderView.performLayout (package:flutter/src/rendering/view.dart:147:13)
I/flutter ( 6261): #58 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1509:7)
I/flutter ( 6261): #59 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:768:18)
I/flutter ( 6261): #60 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:281:19)
I/flutter ( 6261): #61 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:677:13)
I/flutter ( 6261): #62 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:219:5)
I/flutter ( 6261): #63 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:990:15)
I/flutter ( 6261): #64 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:930:9)
I/flutter ( 6261): #65 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.scheduleWarmUpFrame. (package:flutter/src/scheduler/binding.dart:751:7)
I/flutter ( 6261): #67 _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)
I/flutter ( 6261): #68 _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)
I/flutter ( 6261): #69 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
I/flutter ( 6261): (elided one frame from package dart:async)
I/flutter ( 6261):
I/flutter ( 6261): The following RenderObject was being processed when the exception was fired:
I/flutter ( 6261): _RenderDecoration#6a3bd relayoutBoundary=up5 NEEDS-LAYOUT NEEDS-PAINT
I/flutter ( 6261): creator: _Decorator ← InputDecorator ← AnimatedBuilder ← Listener ← RawGestureDetector ←
I/flutter ( 6261): GestureDetector ← IgnorePointer ← Semantics ← TextField ← Row ← MediaQuery ←
I/flutter ( 6261): LayoutId-[<_ScaffoldSlot.body>] ← ⋯
I/flutter ( 6261): parentData: (can use size)
I/flutter ( 6261): constraints: BoxConstraints(0.0<=w<=Infinity, 0.0<=h<=401.1)
I/flutter ( 6261): size: MISSING
I/flutter ( 6261): This RenderObject had the following descendants (showing up to depth 5):
I/flutter ( 6261): RenderRepaintBoundary#f8b61 NEEDS-LAYOUT NEEDS-PAINT
I/flutter ( 6261): RenderRepaintBoundary#4b516 NEEDS-LAYOUT NEEDS-PAINT
I/flutter ( 6261): RenderCustomPaint#b491d NEEDS-LAYOUT NEEDS-PAINT
I/flutter ( 6261): RenderRepaintBoundary#dc7b8 NEEDS-LAYOUT NEEDS-PAINT
I/flutter ( 6261): RenderPointerListener#0cd6b NEEDS-LAYOUT NEEDS-PAINT
I/flutter ( 6261): RenderConstrainedBox#dbff5 NEEDS-LAYOUT NEEDS-PAINT
I/flutter ( 6261): RenderCustomPaint#e3e37 NEEDS-LAYOUT NEEDS-PAINT
I/flutter ( 6261): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter ( 6261): Another exception was thrown: RenderBox was not laid out: _RenderDecoration#6a3bd relayoutBoundary=up5 NEEDS-PAINT
I/flutter ( 6261): Another exception was thrown: RenderBox was not laid out: RenderPointerListener#28755 relayoutBoundary=up4 NEEDS-PAINT
I/flutter ( 6261): Another exception was thrown: RenderBox was not laid out: RenderIgnorePointer#1f559 relayoutBoundary=up3 NEEDS-PAINT
I/flutter ( 6261): Another exception was thrown: RenderBox was not laid out: RenderSemanticsAnnotations#0bd0e relayoutBoundary=up2 NEEDS-PAINT
I/flutter ( 6261): Another exception was thrown: RenderBox was not laid out: RenderFlex#cc8eb relayoutBoundary=up1 NEEDS-PAINT
I/flutter ( 6261): Another exception was thrown: NoSuchMethodError: The method '<=' was called on null.
I/flutter ( 6261): Another exception was thrown: BoxConstraints forces an infinite width.
I/flutter ( 6261): Another exception was thrown: RenderBox was not laid out: _RenderDecoration#6a3bd relayoutBoundary=up5 NEEDS-PAINT
I/flutter ( 6261): Another exception was thrown: RenderBox was not laid out: RenderPointerListener#28755 relayoutBoundary=up4 NEEDS-PAINT
I/flutter ( 6261): Another exception was thrown: RenderBox was not laid out: RenderIgnorePointer#1f559 relayoutBoundary=up3 NEEDS-PAINT
I/flutter ( 6261): Another exception was thrown: RenderBox was not laid out: RenderSemanticsAnnotations#0bd0e relayoutBoundary=up2 NEEDS-PAINT
I/flutter ( 6261): Another exception was thrown: RenderBox was not laid out: RenderFlex#cc8eb relayoutBoundary=up1 NEEDS-PAINT
I/flutter ( 6261): Another exception was thrown: NoSuchMethodError: The method '<=' was called on null.
E/flutter ( 6261): [ERROR:flutter/shell/common/shell.cc(184)] Dart Error: Unhandled exception:
E/flutter ( 6261): Cannot hit test a render box that has never been laid out.
E/flutter ( 6261): The hitTest() method was called on this RenderBox:
E/flutter ( 6261): RenderStack#c788c NEEDS-LAYOUT NEEDS-PAINT
E/flutter ( 6261): Unfortunately, this object's geometry is not known at this time, probably because it has never been laid out. This means it cannot be accurately hit-tested. If you are trying to perform a hit test during the layout phase itself, make sure you only hit test nodes that have completed layout (e.g. the node's children, after their layout() method has been called).
E/flutter ( 6261): #0 RenderBox.hitTest. (package:flutter/src/rendering/box.dart:1889:11)
E/flutter ( 6261): #1 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1912:6)
E/flutter ( 6261): #2 _RenderCustomMultiChildLayoutBox&RenderBox&ContainerRenderObjectMixin&RenderBoxContainerDefaultsMixin.defaultHitTestChildren (package:flutter/src/rendering/box.dart:2256:17)
E/flutter ( 6261): #3 RenderCustomMultiChildLayoutBox.hitTestChildren (package:flutter/src/rendering/custom_layout.dart:366:12)
E/flutter ( 6261): #4 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1914:11)
E/flutter ( 6261): #5 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:113:19)
E/flutter ( 6261): #6 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1914:11)
E/flutter ( 6261): #7 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:113:19)
E/flutter ( 6261): #8 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1914:11)
E/flutter ( 6261): #9 RenderPhysicalModel.hitTest (package:flutter/src/rendering/proxy_box.dart:1651:18)
E/flutter ( 6261): #10 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:113:19)
E/flutter ( 6261): #11 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1914:11)
E/flutter ( 6261): #12 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:113:19)
E/flutter ( 6261): #13 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1914:11)
E/flutter ( 6261): #14 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:113:19)
E/flutter ( 6261): #15 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1914:11)
E/flutter ( 6261): #16 RenderIgnorePointer.hitTest (package:flutter/src/rendering/proxy_box.dart:2777:37)
E/flutter ( 6261): #17 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:113:19)
E/flutter ( 6261): #18 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1914:11)
E/flutter ( 6261): #19 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:113:19)
E/flutter ( 6261): #20 RenderFractionalTranslation.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:2409:18)
E/flutter ( 6261): #21 RenderFractionalTranslation.hitTest (package:flutter/src/rendering/proxy_box.dart:2389:12)
E/flutter ( 6261): #22 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:113:19)
E/flutter ( 6261): #23 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1914:11)
E/flutter ( 6261): #24 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:113:19)
E/flutter ( 6261): #25 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1914:11)
E/flutter ( 6261): #26 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:113:19)
E/flutter ( 6261): #27 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1914:11)
E/flutter ( 6261): #28 RenderOffstage.hitTest (package:flutter/src/rendering/proxy_box.dart:2887:31)
E/flutter ( 6261): #29 _RenderStack&RenderBox&ContainerRenderObjectMixin&RenderBoxContainerDefaultsMixin.defaultHitTestChildren (package:flutter/src/rendering/box.dart:2256:17)
E/flutter ( 6261): #30 RenderStack.hitTestChildren (package:flutter/src/rendering/stack.dart:585:12)
E/flutter ( 6261): #31 RenderBox

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment