├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── doc └── api │ ├── __404error.html │ ├── categories.json │ ├── index.html │ ├── index.json │ ├── json_to_form │ ├── CoreForm-class.html │ ├── CoreForm │ │ ├── CoreForm.html │ │ ├── createElement.html │ │ ├── createState.html │ │ ├── debugDescribeChildren.html │ │ ├── debugFillProperties.html │ │ ├── form.html │ │ ├── form_map.html │ │ ├── hashCode.html │ │ ├── key.html │ │ ├── noSuchMethod.html │ │ ├── onChanged.html │ │ ├── operator_equals.html │ │ ├── padding.html │ │ ├── runtimeType.html │ │ ├── toDiagnosticsNode.html │ │ ├── toString.html │ │ ├── toStringDeep.html │ │ ├── toStringShallow.html │ │ └── toStringShort.html │ └── json_to_form-library.html │ └── static-assets │ ├── URI.js │ ├── css │ ├── bootstrap.css │ ├── bootstrap.css.map │ └── bootstrap.min.css │ ├── favicon.png │ ├── github.css │ ├── highlight.pack.js │ ├── play_button.svg │ ├── readme.md │ ├── script.js │ ├── sdk_footer_text.html │ ├── styles.css │ └── typeahead.bundle.min.js ├── example ├── .gitignore ├── .metadata ├── README.md ├── analysis_options.yaml ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── codigopanda │ │ │ │ │ └── example │ │ │ │ │ └── MainActivity.java │ │ │ └── res │ │ │ │ ├── drawable-v21 │ │ │ │ └── launch_background.xml │ │ │ │ ├── drawable │ │ │ │ └── launch_background.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── values-night │ │ │ │ └── styles.xml │ │ │ │ └── values │ │ │ │ └── styles.xml │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── forms │ └── register.json ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── Runner-Bridging-Header.h ├── lib │ ├── all_fields.dart │ ├── all_fields_v1.dart │ ├── login.dart │ ├── main.dart │ ├── register.dart │ └── register_with_map.dart ├── pubspec.yaml └── test │ └── widget_test.dart ├── images ├── image1.png ├── image2.png ├── image3.png └── image4.png ├── ios ├── Flutter │ ├── Generated.xcconfig │ └── flutter_export_environment.sh └── Runner │ ├── GeneratedPluginRegistrant.h │ └── GeneratedPluginRegistrant.m ├── json_to_form.iml ├── lib ├── components │ ├── index.dart │ ├── simple_checkbox.dart │ ├── simple_date.dart │ ├── simple_radios.dart │ ├── simple_select.dart │ ├── simple_switch.dart │ └── simple_text.dart ├── functions.dart ├── json_schema.dart └── json_to_form.dart ├── pubspec.yaml └── test └── json_to_form_test.dart /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .atom/ 3 | .dart_tool/ 4 | .idea 5 | .packages 6 | .pub/ 7 | packages 8 | pubspec.lock 9 | .fvm/ -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [0.0.5] - 08/03/2023 2 | 3 | * Update Package 4 | * Update Example 5 | 6 | ## [0.0.4] - 02/02/2020 7 | 8 | * Fix Initial Value in TextField 9 | 10 | ## [0.0.3] - TODO: Add release date. 11 | 12 | * Add new field Select 13 | * You can customize the validations 14 | * You can customize the decoration 15 | * More stable structure 16 | 17 | ## [0.0.2] - TODO: Add release date. 18 | 19 | * Support for dart 2 and added dartdoc 20 | 21 | ## [0.0.1] - TODO: Add release date. 22 | 23 | * Basic convert Json to Form 24 | -------------------------------------------------------------------------------- /doc/api/__404error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | json_to_form - Dart API docs 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 |
23 | 26 |
json_to_form
27 | 30 |
31 | 32 |
33 | 34 | 41 | 42 |
43 |

404: Something's gone wrong :-(

44 | 45 |
46 |

You've tried to visit a page that doesn't exist. Luckily this site 47 | has other pages.

48 |

If you were looking for something specific, try searching: 49 |

52 |

53 | 54 |
55 |
56 | 57 |
58 | 59 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /doc/api/categories.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /doc/api/index.json: -------------------------------------------------------------------------------- 1 | [{"name":"json_to_form","qualifiedName":"json_to_form","href":"json_to_form/json_to_form-library.html","type":"library","overriddenDepth":0},{"name":"CoreForm","qualifiedName":"json_to_form.CoreForm","href":"json_to_form/CoreForm-class.html","type":"class","overriddenDepth":0,"enclosedBy":{"name":"json_to_form","type":"library"}},{"name":"CoreForm","qualifiedName":"json_to_form.CoreForm","href":"json_to_form/CoreForm/CoreForm.html","type":"constructor","overriddenDepth":0,"enclosedBy":{"name":"CoreForm","type":"class"}},{"name":"operator ==","qualifiedName":"json_to_form.CoreForm.==","href":"json_to_form/CoreForm/operator_equals.html","type":"method","overriddenDepth":0,"enclosedBy":{"name":"CoreForm","type":"class"}},{"name":"createElement","qualifiedName":"json_to_form.CoreForm.createElement","href":"json_to_form/CoreForm/createElement.html","type":"method","overriddenDepth":1,"enclosedBy":{"name":"CoreForm","type":"class"}},{"name":"createState","qualifiedName":"json_to_form.CoreForm.createState","href":"json_to_form/CoreForm/createState.html","type":"method","overriddenDepth":1,"enclosedBy":{"name":"CoreForm","type":"class"}},{"name":"debugDescribeChildren","qualifiedName":"json_to_form.CoreForm.debugDescribeChildren","href":"json_to_form/CoreForm/debugDescribeChildren.html","type":"method","overriddenDepth":0,"enclosedBy":{"name":"CoreForm","type":"class"}},{"name":"debugFillProperties","qualifiedName":"json_to_form.CoreForm.debugFillProperties","href":"json_to_form/CoreForm/debugFillProperties.html","type":"method","overriddenDepth":1,"enclosedBy":{"name":"CoreForm","type":"class"}},{"name":"form","qualifiedName":"json_to_form.CoreForm.form","href":"json_to_form/CoreForm/form.html","type":"property","overriddenDepth":0,"enclosedBy":{"name":"CoreForm","type":"class"}},{"name":"form_map","qualifiedName":"json_to_form.CoreForm.form_map","href":"json_to_form/CoreForm/form_map.html","type":"property","overriddenDepth":0,"enclosedBy":{"name":"CoreForm","type":"class"}},{"name":"hashCode","qualifiedName":"json_to_form.CoreForm.hashCode","href":"json_to_form/CoreForm/hashCode.html","type":"property","overriddenDepth":0,"enclosedBy":{"name":"CoreForm","type":"class"}},{"name":"key","qualifiedName":"json_to_form.CoreForm.key","href":"json_to_form/CoreForm/key.html","type":"property","overriddenDepth":0,"enclosedBy":{"name":"CoreForm","type":"class"}},{"name":"noSuchMethod","qualifiedName":"json_to_form.CoreForm.noSuchMethod","href":"json_to_form/CoreForm/noSuchMethod.html","type":"method","overriddenDepth":0,"enclosedBy":{"name":"CoreForm","type":"class"}},{"name":"onChanged","qualifiedName":"json_to_form.CoreForm.onChanged","href":"json_to_form/CoreForm/onChanged.html","type":"property","overriddenDepth":0,"enclosedBy":{"name":"CoreForm","type":"class"}},{"name":"padding","qualifiedName":"json_to_form.CoreForm.padding","href":"json_to_form/CoreForm/padding.html","type":"property","overriddenDepth":0,"enclosedBy":{"name":"CoreForm","type":"class"}},{"name":"runtimeType","qualifiedName":"json_to_form.CoreForm.runtimeType","href":"json_to_form/CoreForm/runtimeType.html","type":"property","overriddenDepth":0,"enclosedBy":{"name":"CoreForm","type":"class"}},{"name":"toDiagnosticsNode","qualifiedName":"json_to_form.CoreForm.toDiagnosticsNode","href":"json_to_form/CoreForm/toDiagnosticsNode.html","type":"method","overriddenDepth":1,"enclosedBy":{"name":"CoreForm","type":"class"}},{"name":"toString","qualifiedName":"json_to_form.CoreForm.toString","href":"json_to_form/CoreForm/toString.html","type":"method","overriddenDepth":1,"enclosedBy":{"name":"CoreForm","type":"class"}},{"name":"toStringDeep","qualifiedName":"json_to_form.CoreForm.toStringDeep","href":"json_to_form/CoreForm/toStringDeep.html","type":"method","overriddenDepth":0,"enclosedBy":{"name":"CoreForm","type":"class"}},{"name":"toStringShallow","qualifiedName":"json_to_form.CoreForm.toStringShallow","href":"json_to_form/CoreForm/toStringShallow.html","type":"method","overriddenDepth":0,"enclosedBy":{"name":"CoreForm","type":"class"}},{"name":"toStringShort","qualifiedName":"json_to_form.CoreForm.toStringShort","href":"json_to_form/CoreForm/toStringShort.html","type":"method","overriddenDepth":2,"enclosedBy":{"name":"CoreForm","type":"class"}}] 2 | -------------------------------------------------------------------------------- /doc/api/json_to_form/CoreForm/CoreForm.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | CoreForm constructor - CoreForm class - json_to_form library - Dart API 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 |
24 | 25 | 31 |
CoreForm
32 | 35 |
36 | 37 |
38 | 39 | 75 | 76 |
77 |

CoreForm constructor

78 | 79 |
80 | const 81 | CoreForm({@required String form, @required ValueChanged onChanged, double padding, dynamic form_map }) 82 |
83 | 84 | 85 |
86 |

Implementation

87 |
const CoreForm({
 88 |   @required this.form,
 89 |   @required this.onChanged,
 90 |   this.padding,
 91 |   this.form_map,
 92 | });
93 |
94 | 95 |
96 | 97 | 99 | 100 |
101 | 102 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /doc/api/json_to_form/CoreForm/createElement.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | createElement method - CoreForm class - json_to_form library - Dart API 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 |
24 | 25 | 31 |
createElement
32 | 35 |
36 | 37 |
38 | 39 | 75 | 76 |
77 |

createElement method

78 | 79 |
80 |
81 |
    82 |
  1. @override
  2. 83 |
84 |
85 | StatefulElement 86 | createElement 87 | () 88 |
89 |
90 |

Creates a StatefulElement to manage this widget's location in the tree.

91 |

It is uncommon for subclasses to override this method.

92 |
93 | 94 |
95 |

Implementation

96 |
@override
 97 | StatefulElement createElement() => StatefulElement(this);
98 |
99 | 100 |
101 | 102 | 104 | 105 |
106 | 107 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /doc/api/json_to_form/CoreForm/createState.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | createState method - CoreForm class - json_to_form library - Dart API 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 |
24 | 25 | 31 |
createState
32 | 35 |
36 | 37 |
38 | 39 | 75 | 76 |
77 |

createState method

78 | 79 |
80 |
81 |
    82 |
  1. @override
  2. 83 |
84 |
85 | _CoreFormState 86 | createState 87 | () 88 |
89 |
90 |

Creates the mutable state for this widget at a given location in the tree.

91 |

Subclasses should override this method to return a newly created 92 | instance of their associated State subclass:

93 |
@override
 94 | _MyState createState() => _MyState();
 95 | 
96 |

The framework can call this method multiple times over the lifetime of 97 | a StatefulWidget. For example, if the widget is inserted into the tree 98 | in multiple locations, the framework will create a separate State object 99 | for each location. Similarly, if the widget is removed from the tree and 100 | later inserted into the tree again, the framework will call createState 101 | again to create a fresh State object, simplifying the lifecycle of 102 | State objects.

103 |
104 | 105 |
106 |

Implementation

107 |
@override
108 | _CoreFormState createState() =>
109 |     new _CoreFormState(form_map ?? json.decode(form));
110 |
111 | 112 |
113 | 114 | 116 | 117 |
118 | 119 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /doc/api/json_to_form/CoreForm/debugDescribeChildren.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | debugDescribeChildren method - CoreForm class - json_to_form library - Dart API 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 |
24 | 25 | 31 |
debugDescribeChildren
32 | 35 |
36 | 37 |
38 | 39 | 75 | 76 |
77 |

debugDescribeChildren method

78 | 79 |
80 |
81 |
    82 |
  1. @protected
  2. 83 |
84 |
85 | List<DiagnosticsNode> 86 | debugDescribeChildren 87 | () 88 |
89 |
90 |

Returns a list of DiagnosticsNode objects describing this node's 91 | children.

92 |

Children that are offstage should be added with style set to 93 | DiagnosticsTreeStyle.offstage to indicate that they are offstage.

94 |

The list must not contain any null entries. If there are explicit null 95 | children to report, consider new DiagnosticsNode.message or 96 | DiagnosticsProperty<Object> as possible DiagnosticsNode objects to 97 | provide.

98 |

See also:

  • RenderTable.debugDescribeChildren, which provides high quality custom 99 | descriptions for its child nodes.
100 |

Used by toStringDeep, toDiagnosticsNode and toStringShallow.

101 |
102 | 103 |
104 |

Implementation

105 |
@protected
106 | List<DiagnosticsNode> debugDescribeChildren() => const <DiagnosticsNode>[];
107 |
108 | 109 |
110 | 111 | 113 | 114 |
115 | 116 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /doc/api/json_to_form/CoreForm/form.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | form property - CoreForm class - json_to_form library - Dart API 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 |
24 | 25 | 31 |
form
32 | 35 |
36 | 37 |
38 | 39 | 75 | 76 |
77 |

form property

78 | 79 |
80 | String 81 | form 82 |
final
83 |
84 |
85 |

Implementation

86 |
final String form
 87 | 
 88 | 
89 |
90 | 91 |
92 | 93 | 95 | 96 |
97 | 98 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /doc/api/json_to_form/CoreForm/form_map.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | form_map property - CoreForm class - json_to_form library - Dart API 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 |
24 | 25 | 31 |
form_map
32 | 35 |
36 | 37 |
38 | 39 | 75 | 76 |
77 |

form_map property

78 | 79 |
80 | dynamic 81 | form_map 82 |
final
83 |
84 |
85 |

Implementation

86 |
final dynamic form_map
 87 | 
 88 | 
89 |
90 | 91 |
92 | 93 | 95 | 96 |
97 | 98 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /doc/api/json_to_form/CoreForm/key.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | key property - CoreForm class - json_to_form library - Dart API 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 |
24 | 25 | 31 |
key
32 | 35 |
36 | 37 |
38 | 39 | 75 | 76 |
77 |

key property

78 | 79 |
80 | Key 81 | key 82 |
final, inherited
83 |
84 |
85 |

Controls how one widget replaces another widget in the tree.

86 |

If the runtimeType and key properties of the two widgets are 87 | operator==, respectively, then the new widget replaces the old widget by 88 | updating the underlying element (i.e., by calling Element.update with the 89 | new widget). Otherwise, the old element is removed from the tree, the new 90 | widget is inflated into an element, and the new element is inserted into the 91 | tree.

92 |

In addition, using a GlobalKey as the widget's key allows the element 93 | to be moved around the tree (changing parent) without losing state. When a 94 | new widget is found (its key and type do not match a previous widget in 95 | the same location), but there was a widget with that same global key 96 | elsewhere in the tree in the previous frame, then that widget's element is 97 | moved to the new location.

98 |

Generally, a widget that is the only child of another widget does not need 99 | an explicit key.

100 |

See also the discussions at Key and GlobalKey.

101 |
102 |
103 |

Implementation

104 |
final Key key
105 | 
106 | 
107 |
108 | 109 |
110 | 111 | 113 | 114 |
115 | 116 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /doc/api/json_to_form/CoreForm/noSuchMethod.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | noSuchMethod method - CoreForm class - json_to_form library - Dart API 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 |
24 | 25 | 31 |
noSuchMethod
32 | 35 |
36 | 37 |
38 | 39 | 75 | 76 |
77 |

noSuchMethod method

78 | 79 |
80 | dynamic 81 | noSuchMethod 82 | (Invocation invocation) 83 |
84 |
85 |

Invoked when a non-existent method or property is accessed.

86 |

Classes can override noSuchMethod to provide custom behavior.

87 |

If a value is returned, it becomes the result of the original invocation.

88 |

The default behavior is to throw a NoSuchMethodError.

89 |
90 | 91 |
92 |

Implementation

93 |
@pragma("vm:entry-point")
 94 | external dynamic noSuchMethod(Invocation invocation);
95 |
96 | 97 |
98 | 99 | 101 | 102 |
103 | 104 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /doc/api/json_to_form/CoreForm/onChanged.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | onChanged property - CoreForm class - json_to_form library - Dart API 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 |
24 | 25 | 31 |
onChanged
32 | 35 |
36 | 37 |
38 | 39 | 75 | 76 |
77 |

onChanged property

78 | 79 |
80 | ValueChanged 81 | onChanged 82 |
final
83 |
84 |
85 |

Implementation

86 |
final ValueChanged<dynamic> onChanged
 87 | 
 88 | 
89 |
90 | 91 |
92 | 93 | 95 | 96 |
97 | 98 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /doc/api/json_to_form/CoreForm/operator_equals.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | operator == method - CoreForm class - json_to_form library - Dart API 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 |
24 | 25 | 31 |
operator ==
32 | 35 |
36 | 37 |
38 | 39 | 75 | 76 |
77 |

operator == method

78 | 79 |
80 | bool 81 | operator == 82 | (dynamic other) 83 |
84 |
85 |

The equality operator.

86 |

The default behavior for all Objects is to return true if and 87 | only if this and other are the same object.

88 |

Override this method to specify a different equality relation on 89 | a class. The overriding method must still be an equivalence relation. 90 | That is, it must be:

  • 91 |

    Total: It must return a boolean for all arguments. It should never throw 92 | or return null.

  • 93 |

    Reflexive: For all objects o, o == o must be true.

  • 94 |

    Symmetric: For all objects o1 and o2, o1 == o2 and o2 == o1 must 95 | either both be true, or both be false.

  • 96 |

    Transitive: For all objects o1, o2, and o3, if o1 == o2 and 97 | o2 == o3 are true, then o1 == o3 must be true.

98 |

The method should also be consistent over time, 99 | so whether two objects are equal should only change 100 | if at least one of the objects was modified.

101 |

If a subclass overrides the equality operator it should override 102 | the hashCode method as well to maintain consistency.

103 |
104 | 105 |
106 |

Implementation

107 |
external bool operator ==(other);
108 |
109 | 110 |
111 | 112 | 114 | 115 |
116 | 117 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | -------------------------------------------------------------------------------- /doc/api/json_to_form/CoreForm/padding.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | padding property - CoreForm class - json_to_form library - Dart API 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 |
24 | 25 | 31 |
padding
32 | 35 |
36 | 37 |
38 | 39 | 75 | 76 |
77 |

padding property

78 | 79 |
80 | double 81 | padding 82 |
final
83 |
84 |
85 |

Implementation

86 |
final double padding
 87 | 
 88 | 
89 |
90 | 91 |
92 | 93 | 95 | 96 |
97 | 98 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /doc/api/json_to_form/CoreForm/runtimeType.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | runtimeType property - CoreForm class - json_to_form library - Dart API 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 |
24 | 25 | 31 |
runtimeType
32 | 35 |
36 | 37 |
38 | 39 | 75 | 76 |
77 |

runtimeType property

78 | 79 | 80 |
81 | 82 |
83 | Type 84 | runtimeType 85 |
inherited
86 |
87 | 88 |
89 |

A representation of the runtime type of the object.

90 |
91 |
92 |

Implementation

93 |
external Type get runtimeType;
94 |
95 |
96 | 97 |
98 | 99 | 101 | 102 |
103 | 104 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /doc/api/json_to_form/CoreForm/toDiagnosticsNode.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | toDiagnosticsNode method - CoreForm class - json_to_form library - Dart API 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 |
24 | 25 | 31 |
toDiagnosticsNode
32 | 35 |
36 | 37 |
38 | 39 | 75 | 76 |
77 |

toDiagnosticsNode method

78 | 79 |
80 |
81 |
    82 |
  1. @override
  2. 83 |
84 |
85 | DiagnosticsNode 86 | toDiagnosticsNode 87 | ({String name, DiagnosticsTreeStyle style }) 88 |
89 |
90 |

Returns a debug representation of the object that is used by debugging 91 | tools and by toStringDeep.

92 |

Leave name as null if there is not a meaningful description of the 93 | relationship between the this node and its parent.

94 |

Typically the style argument is only specified to indicate an atypical 95 | relationship between the parent and the node. For example, pass 96 | DiagnosticsTreeStyle.offstage to indicate that a node is offstage.

97 |
98 | 99 |
100 |

Implementation

101 |
@override
102 | DiagnosticsNode toDiagnosticsNode({ String name, DiagnosticsTreeStyle style }) {
103 |   return _DiagnosticableTreeNode(
104 |     name: name,
105 |     value: this,
106 |     style: style,
107 |   );
108 | }
109 |
110 | 111 |
112 | 113 | 115 | 116 |
117 | 118 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /doc/api/json_to_form/CoreForm/toString.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | toString method - CoreForm class - json_to_form library - Dart API 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 |
24 | 25 | 31 |
toString
32 | 35 |
36 | 37 |
38 | 39 | 75 | 76 |
77 |

toString method

78 | 79 |
80 |
81 |
    82 |
  1. @override
  2. 83 |
84 |
85 | String 86 | toString 87 | ({DiagnosticLevel minLevel: DiagnosticLevel.debug }) 88 |
89 |
90 |

Returns a string representation of this object.

91 |
92 | 93 |
94 |

Implementation

95 |
@override
 96 | String toString({ DiagnosticLevel minLevel = DiagnosticLevel.debug }) {
 97 |   return toDiagnosticsNode(style: DiagnosticsTreeStyle.singleLine).toString(minLevel: minLevel);
 98 | }
99 |
100 | 101 |
102 | 103 | 105 | 106 |
107 | 108 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /doc/api/json_to_form/CoreForm/toStringShort.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | toStringShort method - CoreForm class - json_to_form library - Dart API 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 |
24 | 25 | 31 |
toStringShort
32 | 35 |
36 | 37 |
38 | 39 | 75 | 76 |
77 |

toStringShort method

78 | 79 |
80 |
81 |
    82 |
  1. @override
  2. 83 |
84 |
85 | String 86 | toStringShort 87 | () 88 |
89 |
90 |

A short, textual description of this widget.

91 |
92 | 93 |
94 |

Implementation

95 |
@override
 96 | String toStringShort() {
 97 |   return key == null ? '$runtimeType' : '$runtimeType-$key';
 98 | }
99 |
100 | 101 |
102 | 103 | 105 | 106 |
107 | 108 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /doc/api/json_to_form/json_to_form-library.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | json_to_form library - Dart API 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 |
24 | 25 | 29 |
json_to_form
30 | 33 |
34 | 35 |
36 | 37 | 44 | 45 |
46 |

json_to_form library

47 | 48 | 49 |
50 |

Classes

51 | 52 |
53 |
54 | CoreForm 55 |
56 |
57 | 58 |
59 |
60 |
61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 |
69 | 70 | 83 | 84 |
85 | 86 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /doc/api/static-assets/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VictorRancesCode/json_to_form/6549ebaea672c0c34ef59a8f12a0502a63402222/doc/api/static-assets/favicon.png -------------------------------------------------------------------------------- /doc/api/static-assets/github.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | github.com style (c) Vasily Polovnyov 4 | 5 | */ 6 | 7 | .hljs { 8 | display: block; 9 | overflow-x: auto; 10 | padding: 0.5em; 11 | color: #333; 12 | background: #f8f8f8; 13 | } 14 | 15 | .hljs-comment, 16 | .hljs-quote { 17 | color: #998; 18 | font-style: italic; 19 | } 20 | 21 | .hljs-keyword, 22 | .hljs-selector-tag, 23 | .hljs-subst { 24 | color: #333; 25 | font-weight: bold; 26 | } 27 | 28 | .hljs-number, 29 | .hljs-literal, 30 | .hljs-variable, 31 | .hljs-template-variable, 32 | .hljs-tag .hljs-attr { 33 | color: #008080; 34 | } 35 | 36 | .hljs-string, 37 | .hljs-doctag { 38 | color: #d14; 39 | } 40 | 41 | .hljs-title, 42 | .hljs-section, 43 | .hljs-selector-id { 44 | color: #900; 45 | font-weight: bold; 46 | } 47 | 48 | .hljs-subst { 49 | font-weight: normal; 50 | } 51 | 52 | .hljs-type, 53 | .hljs-class .hljs-title { 54 | color: #458; 55 | font-weight: bold; 56 | } 57 | 58 | .hljs-tag, 59 | .hljs-name, 60 | .hljs-attribute { 61 | color: #000080; 62 | font-weight: normal; 63 | } 64 | 65 | .hljs-regexp, 66 | .hljs-link { 67 | color: #009926; 68 | } 69 | 70 | .hljs-symbol, 71 | .hljs-bullet { 72 | color: #990073; 73 | } 74 | 75 | .hljs-built_in, 76 | .hljs-builtin-name { 77 | color: #0086b3; 78 | } 79 | 80 | .hljs-meta { 81 | color: #999; 82 | font-weight: bold; 83 | } 84 | 85 | .hljs-deletion { 86 | background: #fdd; 87 | } 88 | 89 | .hljs-addition { 90 | background: #dfd; 91 | } 92 | 93 | .hljs-emphasis { 94 | font-style: italic; 95 | } 96 | 97 | .hljs-strong { 98 | font-weight: bold; 99 | } 100 | -------------------------------------------------------------------------------- /doc/api/static-assets/play_button.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /doc/api/static-assets/readme.md: -------------------------------------------------------------------------------- 1 | # highlight.js 2 | 3 | Generated from https://highlightjs.org/download/ on 2017-08-30 4 | 5 | Included languages: 6 | 7 | * bash 8 | * css 9 | * dart 10 | * java 11 | * javascript 12 | * json 13 | * markdown 14 | * objectivec 15 | * ruby - dragged in by `yaml` - 🙄 16 | * shell 17 | * swift 18 | * xml - includes html 19 | * yaml 20 | -------------------------------------------------------------------------------- /doc/api/static-assets/script.js: -------------------------------------------------------------------------------- 1 | 2 | function initSideNav() { 3 | var leftNavToggle = document.getElementById('sidenav-left-toggle'); 4 | var leftDrawer = document.querySelector('.sidebar-offcanvas-left'); 5 | var overlay = document.getElementById('overlay-under-drawer'); 6 | 7 | function toggleBoth() { 8 | if (leftDrawer) { 9 | leftDrawer.classList.toggle('active'); 10 | } 11 | 12 | if (overlay) { 13 | overlay.classList.toggle('active'); 14 | } 15 | } 16 | 17 | if (overlay) { 18 | overlay.addEventListener('click', function(e) { 19 | toggleBoth(); 20 | }); 21 | } 22 | 23 | if (leftNavToggle) { 24 | leftNavToggle.addEventListener('click', function(e) { 25 | toggleBoth(); 26 | }); 27 | } 28 | } 29 | 30 | function initSearch(name) { 31 | var searchIndex; // the JSON data 32 | 33 | var weights = { 34 | 'library' : 2, 35 | 'class' : 2, 36 | 'typedef' : 3, 37 | 'method' : 4, 38 | 'accessor' : 4, 39 | 'operator' : 4, 40 | 'property' : 4, 41 | 'constructor' : 4 42 | }; 43 | 44 | function findMatches(q) { 45 | var allMatches = []; // list of matches 46 | 47 | function score(element, num) { 48 | num -= element.overriddenDepth * 10; 49 | var weightFactor = weights[element.type] || 4; 50 | return {e: element, score: (num / weightFactor) >> 0}; 51 | } 52 | 53 | $.each(searchIndex, function(i, element) { 54 | // TODO: prefer matches in the current library 55 | // TODO: help prefer a named constructor 56 | 57 | var lowerName = element.name.toLowerCase(); 58 | var lowerQualifiedName = element.qualifiedName.toLowerCase(); 59 | var lowerQ = q.toLowerCase(); 60 | var previousMatchCount = allMatches.length; 61 | 62 | if (element.name === q || element.qualifiedName === q) { 63 | // exact match, maximum score 64 | allMatches.push(score(element, 2000)); 65 | } else if (element.name === 'dart:'+q) { 66 | // exact match for a dart: library 67 | allMatches.push(score(element, 2000)); 68 | } else if (lowerName === 'dart:'+lowerQ) { 69 | // case-insensitive match for a dart: library 70 | allMatches.push(score(element, 1800)); 71 | } else if (lowerName === lowerQ || lowerQualifiedName === lowerQ) { 72 | // case-insensitive exact match 73 | allMatches.push(score(element, 1700)); 74 | } 75 | 76 | // only care about exact matches if length is 2 or less 77 | // and only continue if we didn't find a match above 78 | if (q.length <= 2 || previousMatchCount < allMatches.length) return; 79 | 80 | if (element.name.indexOf(q) === 0 || element.qualifiedName.indexOf(q) === 0) { 81 | // starts with 82 | allMatches.push(score(element, 750)); 83 | } else if (lowerName.indexOf(lowerQ) === 0 || lowerQualifiedName.indexOf(lowerQ) === 0) { 84 | // case-insensitive starts with 85 | allMatches.push(score(element, 650)); 86 | } else if (element.name.indexOf(q) >= 0 || element.qualifiedName.indexOf(q) >= 0) { 87 | // contains 88 | allMatches.push(score(element, 500)); 89 | } else if (lowerName.indexOf(lowerQ) >= 0 || lowerQualifiedName.indexOf(lowerQ) >= 0) { 90 | // case insensitive contains 91 | allMatches.push(score(element, 400)); 92 | } 93 | }); 94 | 95 | allMatches.sort(function(a, b) { 96 | var x = b.score - a.score; 97 | if (x === 0) { 98 | // tie-breaker: shorter name wins 99 | return a.e.name.length - b.e.name.length; 100 | } else { 101 | return x; 102 | } 103 | }); 104 | 105 | var sortedMatches = []; 106 | for (var i = 0; i < allMatches.length; i++) { 107 | sortedMatches.push(allMatches[i].e); 108 | } 109 | 110 | return sortedMatches; 111 | }; 112 | 113 | function initTypeahead() { 114 | var search = new URI().query(true)["search"]; 115 | if (search) { 116 | var matches = findMatches(search); 117 | if (matches.length != 0) { 118 | window.location = matches[0].href; 119 | return; 120 | } 121 | } 122 | 123 | $('#' + name).prop('disabled', false); 124 | $('#' + name).prop('placeholder', 'Search'); 125 | $(document).keypress(function(event) { 126 | if (event.which == 47 /* / */) { 127 | event.preventDefault(); 128 | $('#' + name).focus(); 129 | } 130 | }); 131 | 132 | $('#' + name + '.typeahead').typeahead({ 133 | hint: true, 134 | highlight: true, 135 | minLength: 1 136 | }, 137 | { 138 | name: 'elements', 139 | limit: 10, 140 | source: function(q, cb) { cb(findMatches(q)); }, 141 | display: function(element) { return element.name; }, 142 | templates: { 143 | suggestion: function(match) { 144 | return [ 145 | '
', 146 | match.name, 147 | ' ', 148 | match.type.toLowerCase(), 149 | (match.enclosedBy ? [ 150 | '
from ', 151 | match.enclosedBy.name, 152 | '
'].join('') : ''), 153 | '
' 154 | ].join(''); 155 | } 156 | } 157 | }); 158 | 159 | var typeaheadElement = $('#' + name + '.typeahead'); 160 | var typeaheadElementParent = typeaheadElement.parent(); 161 | var selectedSuggestion; 162 | 163 | typeaheadElement.on("keydown", function (e) { 164 | if (e.keyCode === 13) { // Enter 165 | if (selectedSuggestion == null) { 166 | var suggestion = typeaheadElementParent.find(".tt-suggestion.tt-selectable:eq(0)"); 167 | if (suggestion.length > 0) { 168 | var href = suggestion.data("href"); 169 | if (href != null) { 170 | window.location = href; 171 | } 172 | } 173 | } 174 | } 175 | }); 176 | 177 | typeaheadElement.bind('typeahead:select', function(ev, suggestion) { 178 | selectedSuggestion = suggestion; 179 | window.location = suggestion.href; 180 | }); 181 | } 182 | 183 | var jsonReq = new XMLHttpRequest(); 184 | jsonReq.open('GET', 'index.json', true); 185 | jsonReq.addEventListener('load', function() { 186 | searchIndex = JSON.parse(jsonReq.responseText); 187 | initTypeahead(); 188 | }); 189 | jsonReq.addEventListener('error', function() { 190 | $('#' + name).prop('placeholder', 'Error loading search index'); 191 | }); 192 | jsonReq.send(); 193 | } 194 | 195 | document.addEventListener("DOMContentLoaded", function() { 196 | hljs.initHighlightingOnLoad(); 197 | initSideNav(); 198 | initSearch("search-box"); 199 | initSearch("search-body"); 200 | }); 201 | -------------------------------------------------------------------------------- /doc/api/static-assets/sdk_footer_text.html: -------------------------------------------------------------------------------- 1 | • 2 | 3 | cc license 4 | 5 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Android Studio will place build artifacts here 44 | /android/app/debug 45 | /android/app/profile 46 | /android/app/release 47 | -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 7e9793dee1b85a243edd0e06cb1658e98b077561 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | A new Flutter application. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion flutter.compileSdkVersion 30 | 31 | compileOptions { 32 | sourceCompatibility JavaVersion.VERSION_1_8 33 | targetCompatibility JavaVersion.VERSION_1_8 34 | } 35 | 36 | defaultConfig { 37 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 38 | applicationId "com.codigopanda.example" 39 | minSdkVersion flutter.minSdkVersion 40 | targetSdkVersion flutter.targetSdkVersion 41 | versionCode flutterVersionCode.toInteger() 42 | versionName flutterVersionName 43 | } 44 | 45 | buildTypes { 46 | release { 47 | // TODO: Add your own signing config for the release build. 48 | // Signing with the debug keys for now, so `flutter run --release` works. 49 | signingConfig signingConfigs.debug 50 | } 51 | } 52 | } 53 | 54 | flutter { 55 | source '../..' 56 | } 57 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/codigopanda/example/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.codigopanda.example; 2 | 3 | import io.flutter.embedding.android.FlutterActivity; 4 | 5 | public class MainActivity extends FlutterActivity { 6 | } 7 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VictorRancesCode/json_to_form/6549ebaea672c0c34ef59a8f12a0502a63402222/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VictorRancesCode/json_to_form/6549ebaea672c0c34ef59a8f12a0502a63402222/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VictorRancesCode/json_to_form/6549ebaea672c0c34ef59a8f12a0502a63402222/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VictorRancesCode/json_to_form/6549ebaea672c0c34ef59a8f12a0502a63402222/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VictorRancesCode/json_to_form/6549ebaea672c0c34ef59a8f12a0502a63402222/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.6.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:4.1.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip 7 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /example/forms/register.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "type": "Input", 4 | "title": "Ingresa tu nombre" 5 | }, 6 | { 7 | "type": "Input", 8 | "title": "Ingresa tu Apellido" 9 | }, 10 | { 11 | "type": "RadioButton", 12 | "title": "Ingresa tu Apellido", 13 | "value": 2, 14 | "list": [ 15 | { 16 | "title": "product 1", 17 | "value": 1 18 | }, 19 | { 20 | "title": "product 2", 21 | "value": 2 22 | }, 23 | { 24 | "title": "product 3", 25 | "value": 3 26 | } 27 | ] 28 | }, 29 | { 30 | "type": "Switch", 31 | "title": "Switch test", 32 | "switchValue": false 33 | }, 34 | { 35 | "type": "Checkbox", 36 | "title": "Checkbox test", 37 | "list": [ 38 | { 39 | "title": "product 1", 40 | "value": true 41 | }, 42 | { 43 | "title": "product 2", 44 | "value": false 45 | }, 46 | { 47 | "title": "product 3", 48 | "value": false 49 | } 50 | ] 51 | } 52 | ] -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 11.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VictorRancesCode/json_to_form/6549ebaea672c0c34ef59a8f12a0502a63402222/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VictorRancesCode/json_to_form/6549ebaea672c0c34ef59a8f12a0502a63402222/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VictorRancesCode/json_to_form/6549ebaea672c0c34ef59a8f12a0502a63402222/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VictorRancesCode/json_to_form/6549ebaea672c0c34ef59a8f12a0502a63402222/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VictorRancesCode/json_to_form/6549ebaea672c0c34ef59a8f12a0502a63402222/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VictorRancesCode/json_to_form/6549ebaea672c0c34ef59a8f12a0502a63402222/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VictorRancesCode/json_to_form/6549ebaea672c0c34ef59a8f12a0502a63402222/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VictorRancesCode/json_to_form/6549ebaea672c0c34ef59a8f12a0502a63402222/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VictorRancesCode/json_to_form/6549ebaea672c0c34ef59a8f12a0502a63402222/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VictorRancesCode/json_to_form/6549ebaea672c0c34ef59a8f12a0502a63402222/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VictorRancesCode/json_to_form/6549ebaea672c0c34ef59a8f12a0502a63402222/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VictorRancesCode/json_to_form/6549ebaea672c0c34ef59a8f12a0502a63402222/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VictorRancesCode/json_to_form/6549ebaea672c0c34ef59a8f12a0502a63402222/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VictorRancesCode/json_to_form/6549ebaea672c0c34ef59a8f12a0502a63402222/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VictorRancesCode/json_to_form/6549ebaea672c0c34ef59a8f12a0502a63402222/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VictorRancesCode/json_to_form/6549ebaea672c0c34ef59a8f12a0502a63402222/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VictorRancesCode/json_to_form/6549ebaea672c0c34ef59a8f12a0502a63402222/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VictorRancesCode/json_to_form/6549ebaea672c0c34ef59a8f12a0502a63402222/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Example 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | example 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UIViewControllerBasedStatusBarAppearance 45 | 46 | CADisableMinimumFrameDurationOnPhone 47 | 48 | UIApplicationSupportsIndirectInputEvents 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /example/lib/all_fields.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:json_to_form/json_schema.dart'; 5 | 6 | class AllFields extends StatefulWidget { 7 | AllFields({Key? key}) : super(key: key); 8 | 9 | // This widget is the home page of your application. It is stateful, meaning 10 | // that it has a State object (defined below) that contains fields that affect 11 | // how it looks. 12 | 13 | // This class is the configuration for the state. It holds the values (in this 14 | // case the title) provided by the parent (in this case the App widget) and 15 | // used by the build method of the State. Fields in a Widget subclass are 16 | // always marked "final". 17 | 18 | @override 19 | _AllFields createState() => _AllFields(); 20 | } 21 | 22 | class _AllFields extends State { 23 | String form = json.encode({ 24 | 'title': 'Test Form Json Schema', 25 | 'description': 'My Description', 26 | 'fields': [ 27 | { 28 | 'key': 'input1', 29 | 'type': 'Input', 30 | 'label': 'Hi Group', 31 | 'placeholder': "Hi Group flutter", 32 | 'value': 'defaultValue', 33 | 'required': true 34 | }, 35 | { 36 | 'key': 'password1', 37 | 'type': 'Password', 38 | 'label': 'Password', 39 | 'required': true 40 | }, 41 | { 42 | 'key': 'email1', 43 | 'type': 'Email', 44 | 'label': 'Email test', 45 | 'placeholder': "hola a todos" 46 | }, 47 | { 48 | 'key': 'tareatext1', 49 | 'type': 'TareaText', 50 | 'label': 'TareaText test', 51 | 'placeholder': "hola a todos" 52 | }, 53 | { 54 | 'key': 'radiobutton1', 55 | 'type': 'RadioButton', 56 | 'label': 'Radio Button tests', 57 | 'value': 2, 58 | 'items': [ 59 | { 60 | 'label': "product 1", 61 | 'value': 1, 62 | }, 63 | { 64 | 'label': "product 2", 65 | 'value': 2, 66 | }, 67 | { 68 | 'label': "product 3", 69 | 'value': 3, 70 | } 71 | ] 72 | }, 73 | { 74 | 'key': 'switch1', 75 | 'type': 'Switch', 76 | 'label': 'Switch test', 77 | 'value': false, 78 | }, 79 | { 80 | 'key': 'checkbox1', 81 | 'type': 'Checkbox', 82 | 'label': 'Checkbox test', 83 | 'items': [ 84 | { 85 | 'label': "product 1", 86 | 'value': true, 87 | }, 88 | { 89 | 'label': "product 2", 90 | 'value': false, 91 | }, 92 | { 93 | 'label': "product 3", 94 | 'value': false, 95 | } 96 | ] 97 | }, 98 | { 99 | 'key': 'select1', 100 | 'type': 'Select', 101 | 'label': 'Select test', 102 | 'value': 'product 1', 103 | 'items': [ 104 | { 105 | 'label': "product 1", 106 | 'value': "product 1", 107 | }, 108 | { 109 | 'label': "product 2", 110 | 'value': "product 2", 111 | }, 112 | { 113 | 'label': "product 3", 114 | 'value': "product 3", 115 | } 116 | ] 117 | }, 118 | {'key': 'date', 'type': 'Date', 'label': 'Select test'} 119 | ] 120 | }); 121 | dynamic response; 122 | 123 | @override 124 | Widget build(BuildContext context) { 125 | // This method is rerun every time setState is called, for instance as done 126 | // by the _incrementCounter method above. 127 | // 128 | // The Flutter framework has been optimized to make rerunning build methods 129 | // fast, so that you can just rebuild anything that needs updating rather 130 | // than having to individually change instances of widgets. 131 | return Scaffold( 132 | appBar: AppBar( 133 | // Here we take the value from the MyHomePage object that was created by 134 | // the App.build method, and use it to set our appbar title. 135 | title: const Text("All Fields"), 136 | ), 137 | body: SingleChildScrollView( 138 | child: Container( 139 | // Center is a layout widget. It takes a single child and positions it 140 | // in the middle of the parent. 141 | child: Column(children: [ 142 | JsonSchema( 143 | form: form, 144 | onChanged: (dynamic response) { 145 | this.response = response; 146 | print(jsonEncode(response)); 147 | }, 148 | actionSave: (data) { 149 | print(jsonEncode(data)); 150 | }, 151 | autovalidateMode: AutovalidateMode.always, 152 | buttonSave: Container( 153 | height: 40.0, 154 | color: Colors.blueAccent, 155 | child: const Center( 156 | child: Text("Send", 157 | style: TextStyle( 158 | color: Colors.white, fontWeight: FontWeight.bold)), 159 | ), 160 | ), 161 | ), 162 | ]), 163 | ), 164 | ), 165 | ); 166 | } 167 | } 168 | -------------------------------------------------------------------------------- /example/lib/all_fields_v1.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:json_to_form/json_to_form.dart'; 5 | 6 | class AllFieldsV1 extends StatefulWidget { 7 | AllFieldsV1({Key? key, this.title}) : super(key: key); 8 | 9 | // This widget is the home page of your application. It is stateful, meaning 10 | // that it has a State object (defined below) that contains fields that affect 11 | // how it looks. 12 | 13 | // This class is the configuration for the state. It holds the values (in this 14 | // case the title) provided by the parent (in this case the App widget) and 15 | // used by the build method of the State. Fields in a Widget subclass are 16 | // always marked "final". 17 | 18 | final String? title; 19 | 20 | @override 21 | _AllFieldsV1 createState() => _AllFieldsV1(); 22 | } 23 | 24 | class _AllFieldsV1 extends State { 25 | String sendEmailForm = json.encode([ 26 | {'type': 'Input', 'title': 'Subject', 'placeholder': "Subject"}, 27 | {'type': 'TareaText', 'title': 'Message', 'placeholder': "Content"}, 28 | ]); 29 | String form = json.encode([ 30 | { 31 | 'type': 'Input', 32 | 'title': 'Hi Group', 33 | 'placeholder': "Hi Group flutter", 34 | 'validator': 'digitsOnly' 35 | }, 36 | { 37 | 'type': 'Password', 38 | 'title': 'Password', 39 | }, 40 | {'type': 'Email', 'title': 'Email test', 'placeholder': "hola a todos"}, 41 | { 42 | 'type': 'TareaText', 43 | 'title': 'TareaText test', 44 | 'placeholder': "hola a todos" 45 | }, 46 | { 47 | 'type': 'RadioButton', 48 | 'title': 'Radio Button tests', 49 | 'value': 2, 50 | 'list': [ 51 | { 52 | 'title': "product 1", 53 | 'value': 1, 54 | }, 55 | { 56 | 'title': "product 2", 57 | 'value': 2, 58 | }, 59 | { 60 | 'title': "product 3", 61 | 'value': 3, 62 | } 63 | ] 64 | }, 65 | { 66 | 'type': 'Switch', 67 | 'title': 'Switch test', 68 | 'switchValue': false, 69 | }, 70 | { 71 | 'type': 'Checkbox', 72 | 'title': 'Checkbox test', 73 | 'list': [ 74 | { 75 | 'title': "product 1", 76 | 'value': true, 77 | }, 78 | { 79 | 'title': "product 2", 80 | 'value': false, 81 | }, 82 | { 83 | 'title': "product 3", 84 | 'value': false, 85 | } 86 | ] 87 | }, 88 | { 89 | 'type': 'Checkbox', 90 | 'title': 'Checkbox test 2', 91 | 'list': [ 92 | { 93 | 'title': "product 1", 94 | 'value': true, 95 | }, 96 | { 97 | 'title': "product 2", 98 | 'value': true, 99 | }, 100 | { 101 | 'title': "product 3", 102 | 'value': false, 103 | } 104 | ] 105 | }, 106 | ]); 107 | dynamic response; 108 | 109 | @override 110 | Widget build(BuildContext context) { 111 | print(form); 112 | // This method is rerun every time setState is called, for instance as done 113 | // by the _incrementCounter method above. 114 | // 115 | // The Flutter framework has been optimized to make rerunning build methods 116 | // fast, so that you can just rebuild anything that needs updating rather 117 | // than having to individually change instances of widgets. 118 | return Scaffold( 119 | appBar: AppBar( 120 | // Here we take the value from the MyHomePage object that was created by 121 | // the App.build method, and use it to set our appbar title. 122 | title: const Text("All Fields V1"), 123 | ), 124 | body: SingleChildScrollView( 125 | child: Container( 126 | // Center is a layout widget. It takes a single child and positions it 127 | // in the middle of the parent. 128 | child: Column(children: [ 129 | CoreForm( 130 | enabledBorder: OutlineInputBorder( 131 | borderRadius: BorderRadius.circular(4), 132 | borderSide: const BorderSide(width: 2, color: Colors.red)), 133 | form: form, 134 | onChanged: (dynamic response) { 135 | print(response); 136 | this.response = response; 137 | }, 138 | ), 139 | TextButton( 140 | child: const Text('Send'), 141 | onPressed: () { 142 | print(this.response.toString()); 143 | }) 144 | ]), 145 | ), 146 | ), 147 | ); 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /example/lib/login.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:json_to_form/json_schema.dart'; 5 | 6 | class Login extends StatefulWidget { 7 | Login({Key? key}) : super(key: key); 8 | @override 9 | _Login createState() => _Login(); 10 | } 11 | 12 | class _Login extends State { 13 | String form = json.encode({ 14 | 'fields': [ 15 | { 16 | 'key': 'input1', 17 | 'type': 'Input', 18 | 'label': 'Username', 19 | 'placeholder': "Enter Your Username", 20 | 'required': true 21 | }, 22 | { 23 | 'key': 'password1', 24 | 'type': 'Password', 25 | 'label': 'Password', 26 | 'required': true 27 | }, 28 | ] 29 | }); 30 | dynamic response; 31 | 32 | Map decorations = { 33 | 'input1': const InputDecoration( 34 | prefixIcon: Icon(Icons.account_box), 35 | border: OutlineInputBorder(), 36 | ), 37 | 'password1': const InputDecoration( 38 | prefixIcon: Icon(Icons.security), border: OutlineInputBorder()), 39 | }; 40 | 41 | @override 42 | Widget build(BuildContext context) { 43 | return Scaffold( 44 | appBar: AppBar( 45 | title: const Text("Login"), 46 | ), 47 | body: SingleChildScrollView( 48 | child: Center( 49 | child: Column(children: [ 50 | const Text( 51 | "Login Form", 52 | style: TextStyle(fontSize: 30.0, fontWeight: FontWeight.bold), 53 | ), 54 | JsonSchema( 55 | decorations: decorations, 56 | form: form, 57 | onChanged: (dynamic response) { 58 | this.response = response; 59 | }, 60 | actionSave: (data) { 61 | print(data); 62 | }, 63 | autovalidateMode: AutovalidateMode.onUserInteraction, 64 | buttonSave: Container( 65 | height: 40.0, 66 | color: Colors.blueAccent, 67 | child: const Center( 68 | child: Text("Login", 69 | style: TextStyle( 70 | color: Colors.white, fontWeight: FontWeight.bold)), 71 | ), 72 | ), 73 | ), 74 | ]), 75 | ), 76 | ), 77 | ); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'all_fields.dart'; 5 | import 'login.dart'; 6 | import 'register.dart'; 7 | import 'register_with_map.dart'; 8 | import 'all_fields_v1.dart'; 9 | 10 | void main() => runApp(MyApp()); 11 | 12 | class MyApp extends StatelessWidget { 13 | // This widget is the root of your application. 14 | @override 15 | Widget build(BuildContext context) { 16 | return MaterialApp( 17 | title: 'Flutter Demo', 18 | theme: ThemeData( 19 | // This is the theme of your application. 20 | // 21 | // Try running your application with "flutter run". You'll see the 22 | // application has a blue toolbar. Then, without quitting the app, try 23 | // changing the primarySwatch below to Colors.green and then invoke 24 | // "hot reload" (press "r" in the console where you ran "flutter run", 25 | // or press Run > Flutter Hot Reload in IntelliJ). Notice that the 26 | // counter didn't reset back to zero; the application is not restarted. 27 | primarySwatch: Colors.red, 28 | ), 29 | initialRoute: "/", 30 | routes: { 31 | '/': (context) => MyHomePage(), 32 | '/allfieldsv1': (context) => AllFieldsV1(), 33 | '/allfields': (context) => AllFields(), 34 | '/login': (context) => Login(), 35 | '/register': (context) => Register(), 36 | '/registerMap': (context) => RegisterMap(), 37 | }, 38 | ); 39 | } 40 | } 41 | 42 | class MyHomePage extends StatefulWidget { 43 | MyHomePage({Key? key, this.title}) : super(key: key); 44 | 45 | // This widget is the home page of your application. It is stateful, meaning 46 | // that it has a State object (defined below) that contains fields that affect 47 | // how it looks. 48 | 49 | // This class is the configuration for the state. It holds the values (in this 50 | // case the title) provided by the parent (in this case the App widget) and 51 | // used by the build method of the State. Fields in a Widget subclass are 52 | // always marked "final". 53 | 54 | final String? title; 55 | 56 | @override 57 | _MyHomePageState createState() => new _MyHomePageState(); 58 | } 59 | 60 | class _MyHomePageState extends State { 61 | dynamic response; 62 | 63 | @override 64 | Widget build(BuildContext context) { 65 | // This method is rerun every time setState is called, for instance as done 66 | // by the _incrementCounter method above. 67 | // 68 | // The Flutter framework has been optimized to make rerunning build methods 69 | // fast, so that you can just rebuild anything that needs updating rather 70 | // than having to individually change instances of widgets. 71 | return Scaffold( 72 | appBar: AppBar( 73 | // Here we take the value from the MyHomePage object that was created by 74 | // the App.build method, and use it to set our appbar title. 75 | title: const Text("Test Form Json Schema"), 76 | ), 77 | body: Center( 78 | // Center is a layout widget. It takes a single child and positions it 79 | // in the middle of the parent. 80 | child: Column(children: [ 81 | TextButton( 82 | onPressed: () { 83 | Navigator.pushNamed(context, '/allfieldsv1'); 84 | }, 85 | child: const Text("All Fields V1"), 86 | ), 87 | TextButton( 88 | onPressed: () { 89 | Navigator.pushNamed(context, '/allfields'); 90 | }, 91 | child: const Text("All Fields"), 92 | ), 93 | TextButton( 94 | onPressed: () { 95 | Navigator.pushNamed(context, '/login'); 96 | }, 97 | child: const Text("Login Form Test"), 98 | ), 99 | TextButton( 100 | onPressed: () { 101 | Navigator.pushNamed(context, '/register'); 102 | }, 103 | child: const Text("Register Form Test"), 104 | ), 105 | TextButton( 106 | onPressed: () { 107 | Navigator.pushNamed(context, '/registerMap'); 108 | }, 109 | child: const Text("Register Form Test with Map"), 110 | ), 111 | ]), 112 | ), 113 | ); 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /example/lib/register.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:json_to_form/json_schema.dart'; 5 | 6 | class Register extends StatefulWidget { 7 | Register({Key? key}) : super(key: key); 8 | 9 | // This widget is the home page of your application. It is stateful, meaning 10 | // that it has a State object (defined below) that contains fields that affect 11 | // how it looks. 12 | 13 | // This class is the configuration for the state. It holds the values (in this 14 | // case the title) provided by the parent (in this case the App widget) and 15 | // used by the build method of the State. Fields in a Widget subclass are 16 | // always marked "final". 17 | 18 | @override 19 | _Register createState() => _Register(); 20 | } 21 | 22 | class _Register extends State { 23 | Map keyboardTypes = { 24 | "number": TextInputType.number, 25 | }; 26 | String form = json.encode({ 27 | 'fields': [ 28 | { 29 | 'key': 'name', 30 | 'type': 'Input', 31 | 'label': 'Name', 32 | 'placeholder': "Enter Your Name", 33 | 'required': true, 34 | }, 35 | { 36 | 'key': 'username', 37 | 'type': 'Input', 38 | 'label': 'Username', 39 | 'placeholder': "Enter Your Username", 40 | 'required': true, 41 | 'hiddenLabel': true, 42 | }, 43 | {'key': 'email', 'type': 'Email', 'label': 'email', 'required': true}, 44 | { 45 | 'key': 'password1', 46 | 'type': 'Password', 47 | 'label': 'Password', 48 | 'required': true 49 | }, 50 | {'key': 'number', 'type': 'Input', 'label': 'number', 'required': true}, 51 | ] 52 | }); 53 | dynamic response; 54 | 55 | Map decorations = { 56 | 'email': InputDecoration( 57 | hintText: 'Email', 58 | prefixIcon: const Icon(Icons.email), 59 | contentPadding: const EdgeInsets.fromLTRB(20.0, 15.0, 20.0, 15.0), 60 | border: OutlineInputBorder(borderRadius: BorderRadius.circular(32.0)), 61 | ), 62 | 'username': const InputDecoration( 63 | labelText: "Enter your email", 64 | prefixIcon: Icon(Icons.account_box), 65 | border: OutlineInputBorder(), 66 | ), 67 | 'password1': const InputDecoration( 68 | prefixIcon: Icon(Icons.security), border: OutlineInputBorder()), 69 | }; 70 | 71 | @override 72 | Widget build(BuildContext context) { 73 | // This method is rerun every time setState is called, for instance as done 74 | // by the _incrementCounter method above. 75 | // 76 | // The Flutter framework has been optimized to make rerunning build methods 77 | // fast, so that you can just rebuild anything that needs updating rather 78 | // than having to individually change instances of widgets. 79 | return Scaffold( 80 | appBar: AppBar( 81 | // Here we take the value from the MyHomePage object that was created by 82 | // the App.build method, and use it to set our appbar title. 83 | title: const Text("Login"), 84 | ), 85 | body: SingleChildScrollView( 86 | child: Center( 87 | // Center is a layout widget. It takes a single child and positions it 88 | // in the middle of the parent. 89 | child: Column(children: [ 90 | Container( 91 | margin: const EdgeInsets.only(top: 10.0), 92 | child: const Text( 93 | "Register Form", 94 | style: TextStyle(fontSize: 30.0, fontWeight: FontWeight.bold), 95 | ), 96 | ), 97 | JsonSchema( 98 | decorations: decorations, 99 | keyboardTypes: keyboardTypes, 100 | form: form, 101 | onChanged: (dynamic response) { 102 | print(jsonEncode(response)); 103 | this.response = response; 104 | }, 105 | actionSave: (data) { 106 | print(data); 107 | }, 108 | buttonSave: Container( 109 | height: 40.0, 110 | color: Colors.blueAccent, 111 | child: const Center( 112 | child: Text("Register", 113 | style: TextStyle( 114 | color: Colors.white, fontWeight: FontWeight.bold)), 115 | ), 116 | ), 117 | ), 118 | ]), 119 | ), 120 | ), 121 | ); 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /example/lib/register_with_map.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter/services.dart'; 5 | import 'package:json_to_form/json_schema.dart'; 6 | 7 | class RegisterMap extends StatefulWidget { 8 | RegisterMap({Key? key}) : super(key: key); 9 | 10 | // This widget is the home page of your application. It is stateful, meaning 11 | // that it has a State object (defined below) that contains fields that affect 12 | // how it looks. 13 | 14 | // This class is the configuration for the state. It holds the values (in this 15 | // case the title) provided by the parent (in this case the App widget) and 16 | // used by the build method of the State. Fields in a Widget subclass are 17 | // always marked "final". 18 | 19 | @override 20 | _RegisterMap createState() => _RegisterMap(); 21 | } 22 | 23 | class _RegisterMap extends State { 24 | Map keyboardTypes = { 25 | "username": TextInputType.number, 26 | }; 27 | Map form = { 28 | 'fields': [ 29 | { 30 | 'key': 'name', 31 | 'type': 'Input', 32 | 'label': 'Name', 33 | 'placeholder': "Enter Your Name", 34 | 'required': true, 35 | }, 36 | { 37 | 'key': 'username', 38 | 'type': 'Input', 39 | 'label': 'Username', 40 | 'placeholder': "Enter Your Username", 41 | 'required': true, 42 | 'decoration': const InputDecoration( 43 | prefixIcon: Icon(Icons.account_box), 44 | border: OutlineInputBorder(), 45 | ), 46 | }, 47 | { 48 | 'key': 'email', 49 | 'type': 'Email', 50 | 'label': 'email', 51 | 'required': true, 52 | 'decoration': InputDecoration( 53 | hintText: 'Email', 54 | prefixIcon: const Icon(Icons.email), 55 | contentPadding: const EdgeInsets.fromLTRB(20.0, 15.0, 20.0, 15.0), 56 | border: OutlineInputBorder(borderRadius: BorderRadius.circular(32.0)), 57 | ), 58 | }, 59 | { 60 | 'key': 'password1', 61 | 'type': 'Password', 62 | 'label': 'Password', 63 | 'required': true, 64 | 'decoration': const InputDecoration( 65 | prefixIcon: Icon(Icons.security), border: OutlineInputBorder()), 66 | }, 67 | { 68 | 'key': 'number', 69 | 'type': 'Input', 70 | 'label': 'number', 71 | 'required': true, 72 | 'decoration': const InputDecoration( 73 | prefixIcon: Icon(Icons.format_list_numbered), 74 | border: OutlineInputBorder()), 75 | 'keyboardType': TextInputType.number 76 | }, 77 | { 78 | 'key': 'date', 79 | 'type': 'Date', 80 | 'label': 'date', 81 | 'required': true, 82 | }, 83 | ] 84 | }; 85 | dynamic response; 86 | 87 | @override 88 | Widget build(BuildContext context) { 89 | // This method is rerun every time setState is called, for instance as done 90 | // by the _incrementCounter method above. 91 | // 92 | // The Flutter framework has been optimized to make rerunning build methods 93 | // fast, so that you can just rebuild anything that needs updating rather 94 | // than having to individually change instances of widgets. 95 | return Scaffold( 96 | appBar: AppBar( 97 | // Here we take the value from the MyHomePage object that was created by 98 | // the App.build method, and use it to set our appbar title. 99 | title: const Text("Register Form with Map"), 100 | ), 101 | body: SingleChildScrollView( 102 | child: Center( 103 | // Center is a layout widget. It takes a single child and positions it 104 | // in the middle of the parent. 105 | child: Column(children: [ 106 | Container( 107 | child: const Text( 108 | "Register Form With Map", 109 | style: TextStyle(fontSize: 30.0, fontWeight: FontWeight.bold), 110 | ), 111 | margin: const EdgeInsets.only(top: 10.0), 112 | ), 113 | JsonSchema( 114 | formMap: form, 115 | onChanged: (dynamic response) { 116 | this.response = response; 117 | }, 118 | actionSave: (data) { 119 | print(data['fields'][5]); 120 | }, 121 | autovalidateMode: AutovalidateMode.disabled, 122 | buttonSave: Container( 123 | height: 40.0, 124 | color: Colors.blueAccent, 125 | child: const Center( 126 | child: Text("Register", 127 | style: TextStyle( 128 | color: Colors.white, fontWeight: FontWeight.bold)), 129 | ), 130 | ), 131 | form: null, 132 | ), 133 | ]), 134 | ), 135 | ), 136 | ); 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | description: A new Flutter application. 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `flutter pub publish`. This is preferred for private packages. 6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 7 | 8 | # The following defines the version and build number for your application. 9 | # A version number is three numbers separated by dots, like 1.2.43 10 | # followed by an optional build number separated by a +. 11 | # Both the version and the builder number may be overridden in flutter 12 | # build by specifying --build-name and --build-number, respectively. 13 | # In Android, build-name is used as versionName while build-number used as versionCode. 14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 16 | # Read more about iOS versioning at 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 18 | version: 1.0.0+1 19 | 20 | environment: 21 | sdk: ">=2.16.1 <3.0.0" 22 | 23 | # Dependencies specify other packages that your package needs in order to work. 24 | # To automatically upgrade your package dependencies to the latest versions 25 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 26 | # dependencies can be manually updated by changing the version numbers below to 27 | # the latest version available on pub.dev. To see which dependencies have newer 28 | # versions available, run `flutter pub outdated`. 29 | dependencies: 30 | flutter: 31 | sdk: flutter 32 | 33 | json_to_form: 34 | path: ../ 35 | 36 | 37 | # The following adds the Cupertino Icons font to your application. 38 | # Use with the CupertinoIcons class for iOS style icons. 39 | cupertino_icons: ^1.0.2 40 | 41 | dev_dependencies: 42 | flutter_test: 43 | sdk: flutter 44 | 45 | # The "flutter_lints" package below contains a set of recommended lints to 46 | # encourage good coding practices. The lint set provided by the package is 47 | # activated in the `analysis_options.yaml` file located at the root of your 48 | # package. See that file for information about deactivating specific lint 49 | # rules and activating additional ones. 50 | flutter_lints: ^1.0.0 51 | 52 | # For information on the generic Dart part of this file, see the 53 | # following page: https://dart.dev/tools/pub/pubspec 54 | 55 | # The following section is specific to Flutter. 56 | flutter: 57 | 58 | # The following line ensures that the Material Icons font is 59 | # included with your application, so that you can use the icons in 60 | # the material Icons class. 61 | uses-material-design: true 62 | assets: 63 | - forms/register.json 64 | # To add assets to your application, add an assets section, like this: 65 | # assets: 66 | # - images/a_dot_burr.jpeg 67 | # - images/a_dot_ham.jpeg 68 | 69 | # An image asset can refer to one or more resolution-specific "variants", see 70 | # https://flutter.dev/assets-and-images/#resolution-aware. 71 | 72 | # For details regarding adding assets from package dependencies, see 73 | # https://flutter.dev/assets-and-images/#from-packages 74 | 75 | # To add custom fonts to your application, add a fonts section here, 76 | # in this "flutter" section. Each entry in this list should have a 77 | # "family" key with the font family name, and a "fonts" key with a 78 | # list giving the asset and other descriptors for the font. For 79 | # example: 80 | # fonts: 81 | # - family: Schyler 82 | # fonts: 83 | # - asset: fonts/Schyler-Regular.ttf 84 | # - asset: fonts/Schyler-Italic.ttf 85 | # style: italic 86 | # - family: Trajan Pro 87 | # fonts: 88 | # - asset: fonts/TrajanPro.ttf 89 | # - asset: fonts/TrajanPro_Bold.ttf 90 | # weight: 700 91 | # 92 | # For details regarding fonts from package dependencies, 93 | # see https://flutter.dev/custom-fonts/#from-packages 94 | -------------------------------------------------------------------------------- /example/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:example/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /images/image1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VictorRancesCode/json_to_form/6549ebaea672c0c34ef59a8f12a0502a63402222/images/image1.png -------------------------------------------------------------------------------- /images/image2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VictorRancesCode/json_to_form/6549ebaea672c0c34ef59a8f12a0502a63402222/images/image2.png -------------------------------------------------------------------------------- /images/image3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VictorRancesCode/json_to_form/6549ebaea672c0c34ef59a8f12a0502a63402222/images/image3.png -------------------------------------------------------------------------------- /images/image4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VictorRancesCode/json_to_form/6549ebaea672c0c34ef59a8f12a0502a63402222/images/image4.png -------------------------------------------------------------------------------- /ios/Flutter/Generated.xcconfig: -------------------------------------------------------------------------------- 1 | // This is a generated file; do not edit or check into version control. 2 | FLUTTER_ROOT=/Users/rances/fvm/versions/3.7.3 3 | FLUTTER_APPLICATION_PATH=/Users/rances/Repositorio/Github/json_to_form 4 | COCOAPODS_PARALLEL_CODE_SIGN=true 5 | FLUTTER_TARGET=lib/main.dart 6 | FLUTTER_BUILD_DIR=build 7 | FLUTTER_BUILD_NAME=0.0.5 8 | FLUTTER_BUILD_NUMBER=0.0.5 9 | EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386 10 | EXCLUDED_ARCHS[sdk=iphoneos*]=armv7 11 | DART_OBFUSCATION=false 12 | TRACK_WIDGET_CREATION=true 13 | TREE_SHAKE_ICONS=false 14 | PACKAGE_CONFIG=.dart_tool/package_config.json 15 | -------------------------------------------------------------------------------- /ios/Flutter/flutter_export_environment.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This is a generated file; do not edit or check into version control. 3 | export "FLUTTER_ROOT=/Users/rances/fvm/versions/3.7.3" 4 | export "FLUTTER_APPLICATION_PATH=/Users/rances/Repositorio/Github/json_to_form" 5 | export "COCOAPODS_PARALLEL_CODE_SIGN=true" 6 | export "FLUTTER_TARGET=lib/main.dart" 7 | export "FLUTTER_BUILD_DIR=build" 8 | export "FLUTTER_BUILD_NAME=0.0.5" 9 | export "FLUTTER_BUILD_NUMBER=0.0.5" 10 | export "DART_OBFUSCATION=false" 11 | export "TRACK_WIDGET_CREATION=true" 12 | export "TREE_SHAKE_ICONS=false" 13 | export "PACKAGE_CONFIG=.dart_tool/package_config.json" 14 | -------------------------------------------------------------------------------- /ios/Runner/GeneratedPluginRegistrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GeneratedPluginRegistrant_h 8 | #define GeneratedPluginRegistrant_h 9 | 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface GeneratedPluginRegistrant : NSObject 15 | + (void)registerWithRegistry:(NSObject*)registry; 16 | @end 17 | 18 | NS_ASSUME_NONNULL_END 19 | #endif /* GeneratedPluginRegistrant_h */ 20 | -------------------------------------------------------------------------------- /ios/Runner/GeneratedPluginRegistrant.m: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #import "GeneratedPluginRegistrant.h" 8 | 9 | @implementation GeneratedPluginRegistrant 10 | 11 | + (void)registerWithRegistry:(NSObject*)registry { 12 | } 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /json_to_form.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /lib/components/index.dart: -------------------------------------------------------------------------------- 1 | export 'simple_text.dart'; 2 | export 'simple_checkbox.dart'; 3 | export 'simple_date.dart'; 4 | export 'simple_radios.dart'; 5 | export 'simple_select.dart'; 6 | export 'simple_switch.dart'; 7 | -------------------------------------------------------------------------------- /lib/components/simple_checkbox.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import '../functions.dart'; 4 | 5 | class SimpleListCheckbox extends StatefulWidget { 6 | SimpleListCheckbox({ 7 | Key? key, 8 | required this.item, 9 | required this.onChange, 10 | required this.position, 11 | this.errorMessages = const {}, 12 | this.validations = const {}, 13 | this.decorations = const {}, 14 | this.keyboardTypes = const {}, 15 | }) : super(key: key); 16 | final dynamic item; 17 | final Function onChange; 18 | final int position; 19 | final Map errorMessages; 20 | final Map validations; 21 | final Map decorations; 22 | final Map keyboardTypes; 23 | 24 | @override 25 | _SimpleListCheckbox createState() => new _SimpleListCheckbox(); 26 | } 27 | 28 | class _SimpleListCheckbox extends State { 29 | dynamic item; 30 | List selectItems = []; 31 | 32 | String? isRequired(item, value) { 33 | if (value.isEmpty) { 34 | return widget.errorMessages[item['key']] ?? 'Please enter some text'; 35 | } 36 | return null; 37 | } 38 | 39 | @override 40 | void initState() { 41 | super.initState(); 42 | item = widget.item; 43 | for (var i = 0; i < item['items'].length; i++) { 44 | if (item['items'][i]['value'] == true) { 45 | selectItems.add(i); 46 | } 47 | } 48 | } 49 | 50 | @override 51 | Widget build(BuildContext context) { 52 | List checkboxes = []; 53 | if (Fun.labelHidden(item)) { 54 | checkboxes.add(new Text(item['label'], 55 | style: new TextStyle(fontWeight: FontWeight.bold, fontSize: 16.0))); 56 | } 57 | for (var i = 0; i < item['items'].length; i++) { 58 | checkboxes.add( 59 | new Row( 60 | children: [ 61 | new Expanded(child: new Text(item['items'][i]['label'])), 62 | new Checkbox( 63 | value: item['items'][i]['value'], 64 | onChanged: (bool? value) { 65 | this.setState( 66 | () { 67 | item['items'][i]['value'] = value; 68 | if (value!) { 69 | selectItems.add(i); 70 | } else { 71 | selectItems.remove(i); 72 | } 73 | widget.onChange(widget.position, selectItems); 74 | //_handleChanged(); 75 | }, 76 | ); 77 | }, 78 | ), 79 | ], 80 | ), 81 | ); 82 | } 83 | return new Container( 84 | margin: new EdgeInsets.only(top: 5.0), 85 | child: Column( 86 | crossAxisAlignment: CrossAxisAlignment.start, 87 | children: checkboxes, 88 | ), 89 | ); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /lib/components/simple_date.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import '../functions.dart'; 4 | 5 | class SimpleDate extends StatefulWidget { 6 | SimpleDate({ 7 | Key? key, 8 | required this.item, 9 | required this.onChange, 10 | required this.position, 11 | this.errorMessages = const {}, 12 | this.validations = const {}, 13 | this.decorations = const {}, 14 | this.keyboardTypes = const {}, 15 | }) : super(key: key); 16 | final dynamic item; 17 | final Function onChange; 18 | final int position; 19 | final Map errorMessages; 20 | final Map validations; 21 | final Map decorations; 22 | final Map keyboardTypes; 23 | 24 | @override 25 | _SimpleDate createState() => new _SimpleDate(); 26 | } 27 | 28 | class _SimpleDate extends State { 29 | dynamic item; 30 | 31 | @override 32 | void initState() { 33 | super.initState(); 34 | item = widget.item; 35 | } 36 | 37 | @override 38 | Widget build(BuildContext context) { 39 | Widget label = SizedBox.shrink(); 40 | if (Fun.labelHidden(item)) { 41 | label = new Container( 42 | child: new Text( 43 | item['label'], 44 | style: new TextStyle(fontWeight: FontWeight.bold, fontSize: 16.0), 45 | ), 46 | ); 47 | } 48 | return new Container( 49 | margin: new EdgeInsets.only(top: 5.0), 50 | child: new Column( 51 | crossAxisAlignment: CrossAxisAlignment.start, 52 | children: [ 53 | label, 54 | new Column( 55 | mainAxisAlignment: MainAxisAlignment.start, 56 | children: [ 57 | InkWell( 58 | // onTap: () { 59 | // selectDate(); 60 | // }, 61 | child: new TextFormField( 62 | readOnly: true, 63 | decoration: InputDecoration( 64 | //border: OutlineInputBorder(), 65 | hintText: item['value'] ?? "", 66 | //prefixIcon: Icon(Icons.date_range_rounded), 67 | suffixIcon: IconButton( 68 | onPressed: () { 69 | selectDate(); 70 | }, 71 | icon: Icon(Icons.calendar_today_rounded), 72 | ), 73 | ), 74 | )), 75 | ], 76 | ) 77 | ], 78 | ), 79 | ); 80 | } 81 | 82 | Future selectDate() async { 83 | DateTime? picked = await showDatePicker( 84 | context: context, 85 | initialDate: DateTime.now().subtract(Duration(days: 360)), 86 | firstDate: DateTime.now().subtract(Duration(days: 360)), 87 | lastDate: DateTime.now().add(Duration(days: 360))); 88 | if (picked != null) { 89 | String date = 90 | "${picked.year.toString()}-${picked.month.toString().padLeft(2, '0')}-${picked.day.toString().padLeft(2, '0')}"; 91 | this.setState(() { 92 | item['value'] = date; 93 | widget.onChange(widget.position, date); 94 | }); 95 | } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /lib/components/simple_radios.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../functions.dart'; 3 | 4 | class SimpleRadios extends StatefulWidget { 5 | SimpleRadios({ 6 | Key? key, 7 | required this.item, 8 | required this.onChange, 9 | required this.position, 10 | this.errorMessages = const {}, 11 | this.validations = const {}, 12 | this.decorations = const {}, 13 | this.keyboardTypes = const {}, 14 | }) : super(key: key); 15 | final dynamic item; 16 | final Function onChange; 17 | final int position; 18 | final Map errorMessages; 19 | final Map validations; 20 | final Map decorations; 21 | final Map keyboardTypes; 22 | 23 | @override 24 | _SimpleRadios createState() => new _SimpleRadios(); 25 | } 26 | 27 | class _SimpleRadios extends State { 28 | dynamic item; 29 | late int radioValue; 30 | 31 | String? isRequired(item, value) { 32 | if (value.isEmpty) { 33 | return widget.errorMessages[item['key']] ?? 'Please enter some text'; 34 | } 35 | return null; 36 | } 37 | 38 | @override 39 | void initState() { 40 | super.initState(); 41 | item = widget.item; 42 | } 43 | 44 | @override 45 | Widget build(BuildContext context) { 46 | List radios = []; 47 | 48 | if (Fun.labelHidden(item)) { 49 | radios.add(new Text(item['label'], 50 | style: new TextStyle(fontWeight: FontWeight.bold, fontSize: 16.0))); 51 | } 52 | radioValue = item['value']; 53 | for (var i = 0; i < item['items'].length; i++) { 54 | radios.add( 55 | new Row( 56 | children: [ 57 | new Expanded(child: new Text(item['items'][i]['label'])), 58 | new Radio( 59 | value: item['items'][i]['value'], 60 | groupValue: radioValue, 61 | onChanged: (dynamic value) { 62 | this.setState(() { 63 | radioValue = value; 64 | item['value'] = value; 65 | widget.onChange(widget.position, value); 66 | }); 67 | }) 68 | ], 69 | ), 70 | ); 71 | } 72 | return new Container( 73 | margin: new EdgeInsets.only(top: 5.0), 74 | child: Column( 75 | crossAxisAlignment: CrossAxisAlignment.start, 76 | children: radios, 77 | ), 78 | ); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/components/simple_select.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import '../functions.dart'; 4 | 5 | class SimpleSelect extends StatefulWidget { 6 | SimpleSelect({ 7 | Key? key, 8 | required this.item, 9 | required this.onChange, 10 | required this.position, 11 | this.errorMessages = const {}, 12 | this.validations = const {}, 13 | this.decorations = const {}, 14 | this.keyboardTypes = const {}, 15 | }) : super(key: key); 16 | final dynamic item; 17 | final Function onChange; 18 | final int position; 19 | final Map errorMessages; 20 | final Map validations; 21 | final Map decorations; 22 | final Map keyboardTypes; 23 | 24 | @override 25 | _SimpleSelect createState() => new _SimpleSelect(); 26 | } 27 | 28 | class _SimpleSelect extends State { 29 | dynamic item; 30 | 31 | String? isRequired(item, value) { 32 | if (value.isEmpty) { 33 | return widget.errorMessages[item['key']] ?? 'Please enter some text'; 34 | } 35 | return null; 36 | } 37 | 38 | @override 39 | void initState() { 40 | super.initState(); 41 | item = widget.item; 42 | } 43 | 44 | @override 45 | Widget build(BuildContext context) { 46 | Widget label = SizedBox.shrink(); 47 | if (Fun.labelHidden(item)) { 48 | label = new Text(item['label'], 49 | style: new TextStyle(fontWeight: FontWeight.bold, fontSize: 16.0)); 50 | } 51 | return new Container( 52 | margin: new EdgeInsets.only(top: 5.0), 53 | child: Column( 54 | crossAxisAlignment: CrossAxisAlignment.start, 55 | children: [ 56 | label, 57 | new DropdownButton( 58 | hint: new Text("Select a user"), 59 | value: item['value'], 60 | onChanged: (String? newValue) { 61 | setState(() { 62 | item['value'] = newValue; 63 | widget.onChange(widget.position, newValue); 64 | }); 65 | }, 66 | items: item['items'].map>((dynamic data) { 67 | return DropdownMenuItem( 68 | value: data['value'], 69 | child: new Text( 70 | data['label'], 71 | style: new TextStyle(color: Colors.black), 72 | ), 73 | ); 74 | }).toList(), 75 | ), 76 | ], 77 | ), 78 | ); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/components/simple_switch.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class SimpleSwitch extends StatefulWidget { 4 | SimpleSwitch({ 5 | Key? key, 6 | required this.item, 7 | required this.onChange, 8 | required this.position, 9 | this.errorMessages = const {}, 10 | this.validations = const {}, 11 | this.decorations = const {}, 12 | this.keyboardTypes = const {}, 13 | }) : super(key: key); 14 | final dynamic item; 15 | final Function onChange; 16 | final int position; 17 | final Map errorMessages; 18 | final Map validations; 19 | final Map decorations; 20 | final Map keyboardTypes; 21 | 22 | @override 23 | _SimpleSwitch createState() => new _SimpleSwitch(); 24 | } 25 | 26 | class _SimpleSwitch extends State { 27 | dynamic item; 28 | 29 | String? isRequired(item, value) { 30 | if (value.isEmpty) { 31 | return widget.errorMessages[item['key']] ?? 'Please enter some text'; 32 | } 33 | return null; 34 | } 35 | 36 | @override 37 | void initState() { 38 | // TODO: implement initState 39 | super.initState(); 40 | item = widget.item; 41 | if (item['value'] == null) { 42 | item['value'] = false; 43 | } 44 | } 45 | 46 | @override 47 | Widget build(BuildContext context) { 48 | // TODO: implement build 49 | return new Container( 50 | margin: new EdgeInsets.only(top: 5.0), 51 | child: new Row(children: [ 52 | new Expanded(child: new Text(item['label'])), 53 | new Switch( 54 | value: item['value'] ?? false, 55 | onChanged: (bool value) { 56 | this.setState(() { 57 | item['value'] = value; 58 | widget.onChange(widget.position, value); 59 | }); 60 | }, 61 | ), 62 | ]), 63 | ); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /lib/components/simple_text.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import '../functions.dart'; 4 | 5 | class SimpleText extends StatefulWidget { 6 | SimpleText({ 7 | Key? key, 8 | required this.item, 9 | required this.onChange, 10 | required this.position, 11 | this.errorMessages = const {}, 12 | this.validations = const {}, 13 | this.decorations = const {}, 14 | this.keyboardTypes = const {}, 15 | }) : super(key: key); 16 | final dynamic item; 17 | final Function onChange; 18 | final int position; 19 | final Map errorMessages; 20 | final Map validations; 21 | final Map decorations; 22 | final Map keyboardTypes; 23 | 24 | @override 25 | _SimpleText createState() => new _SimpleText(); 26 | } 27 | 28 | class _SimpleText extends State { 29 | dynamic item; 30 | 31 | String? isRequired(item, value) { 32 | if (value.isEmpty) { 33 | return widget.errorMessages[item['key']] ?? 'Please enter some text'; 34 | } 35 | return null; 36 | } 37 | 38 | @override 39 | void initState() { 40 | // TODO: implement initState 41 | super.initState(); 42 | item = widget.item; 43 | } 44 | 45 | @override 46 | Widget build(BuildContext context) { 47 | Widget label = SizedBox.shrink(); 48 | if (Fun.labelHidden(item)) { 49 | label = new Container( 50 | child: new Text( 51 | item['label'], 52 | style: new TextStyle(fontWeight: FontWeight.bold, fontSize: 16.0), 53 | ), 54 | ); 55 | } 56 | return new Container( 57 | margin: new EdgeInsets.only(top: 5.0), 58 | child: new Column( 59 | crossAxisAlignment: CrossAxisAlignment.start, 60 | children: [ 61 | label, 62 | new TextFormField( 63 | controller: null, 64 | initialValue: item['value'] ?? null, 65 | decoration: item['decoration'] ?? 66 | widget.decorations[item['key']] ?? 67 | new InputDecoration( 68 | hintText: item['placeholder'] ?? "", 69 | helperText: item['helpText'] ?? "", 70 | ), 71 | maxLines: item['type'] == "TextArea" ? 10 : 1, 72 | onChanged: (String value) { 73 | item['value'] = value; 74 | // _handleChanged(); 75 | // print(value); 76 | widget.onChange(widget.position, value); 77 | }, 78 | obscureText: item['type'] == "Password" ? true : false, 79 | keyboardType: item['keyboardType'] ?? 80 | widget.keyboardTypes[item['key']] ?? 81 | TextInputType.text, 82 | validator: (value) { 83 | if (widget.validations.containsKey(item['key'])) { 84 | return widget.validations[item['key']](item, value); 85 | } 86 | if (item.containsKey('validator')) { 87 | if (item['validator'] != null) { 88 | if (item['validator'] is Function) { 89 | return item['validator'](item, value); 90 | } 91 | } 92 | } 93 | if (item['type'] == "Email") { 94 | return Fun.validateEmail(item, value!); 95 | } 96 | 97 | if (item.containsKey('required')) { 98 | if (item['required'] == true || 99 | item['required'] == 'True' || 100 | item['required'] == 'true') { 101 | return isRequired(item, value); 102 | } 103 | } 104 | return null; 105 | }, 106 | ), 107 | ], 108 | ), 109 | ); 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /lib/functions.dart: -------------------------------------------------------------------------------- 1 | class Fun { 2 | static bool labelHidden(item) { 3 | if (item.containsKey('hiddenLabel')) { 4 | if (item['hiddenLabel'] is bool) { 5 | return !item['hiddenLabel']; 6 | } 7 | } else { 8 | return true; 9 | } 10 | return false; 11 | } 12 | 13 | static String? validateEmail(item, String value) { 14 | String p = "[a-zA-Z0-9\+\.\_\%\-\+]{1,256}" + 15 | "\\@" + 16 | "[a-zA-Z0-9][a-zA-Z0-9\\-]{0,64}" + 17 | "(" + 18 | "\\." + 19 | "[a-zA-Z0-9][a-zA-Z0-9\\-]{0,25}" + 20 | ")+"; 21 | RegExp regExp = new RegExp(p); 22 | 23 | if (regExp.hasMatch(value)) { 24 | return null; 25 | } 26 | return 'Email is not valid'; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/json_schema.dart: -------------------------------------------------------------------------------- 1 | library json_to_form; 2 | 3 | import 'dart:convert'; 4 | import 'package:flutter/material.dart'; 5 | import 'components/index.dart'; 6 | 7 | class JsonSchema extends StatefulWidget { 8 | const JsonSchema({ 9 | this.form, 10 | required this.onChanged, 11 | this.padding, 12 | this.formMap, 13 | this.autovalidateMode, 14 | this.errorMessages = const {}, 15 | this.validations = const {}, 16 | this.decorations = const {}, 17 | this.keyboardTypes = const {}, 18 | this.buttonSave, 19 | this.actionSave, 20 | }); 21 | 22 | final Map errorMessages; 23 | final Map validations; 24 | final Map decorations; 25 | final Map keyboardTypes; 26 | final String? form; 27 | final Map? formMap; 28 | final double? padding; 29 | final Widget? buttonSave; 30 | final Function? actionSave; 31 | final ValueChanged onChanged; 32 | final AutovalidateMode? autovalidateMode; 33 | 34 | @override 35 | _CoreFormState createState() => 36 | new _CoreFormState(formMap ?? json.decode(form!)); 37 | } 38 | 39 | class _CoreFormState extends State { 40 | final dynamic formGeneral; 41 | 42 | late int radioValue; 43 | _CoreFormState(this.formGeneral); 44 | 45 | List jsonToForm() { 46 | List listWidget = []; 47 | if (formGeneral['title'] != null) { 48 | listWidget.add(Text( 49 | formGeneral['title'], 50 | style: new TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0), 51 | )); 52 | } 53 | if (formGeneral['description'] != null) { 54 | listWidget.add(Text( 55 | formGeneral['description'], 56 | style: new TextStyle(fontSize: 14.0, fontStyle: FontStyle.italic), 57 | )); 58 | } 59 | 60 | for (var count = 0; count < formGeneral['fields'].length; count++) { 61 | Map item = formGeneral['fields'][count]; 62 | 63 | if (item['type'] == "Input" || 64 | item['type'] == "Password" || 65 | item['type'] == "Email" || 66 | item['type'] == "TextArea" || 67 | item['type'] == "TextInput") { 68 | listWidget.add(SimpleText( 69 | item: item, 70 | onChange: onChange, 71 | position: count, 72 | decorations: widget.decorations, 73 | errorMessages: widget.errorMessages, 74 | validations: widget.validations, 75 | keyboardTypes: widget.keyboardTypes, 76 | )); 77 | } 78 | 79 | if (item['type'] == "RadioButton") { 80 | listWidget.add(SimpleRadios( 81 | item: item, 82 | onChange: onChange, 83 | position: count, 84 | decorations: widget.decorations, 85 | errorMessages: widget.errorMessages, 86 | validations: widget.validations, 87 | keyboardTypes: widget.keyboardTypes, 88 | )); 89 | } 90 | 91 | if (item['type'] == "Switch") { 92 | listWidget.add(SimpleSwitch( 93 | item: item, 94 | onChange: onChange, 95 | position: count, 96 | decorations: widget.decorations, 97 | errorMessages: widget.errorMessages, 98 | validations: widget.validations, 99 | keyboardTypes: widget.keyboardTypes, 100 | )); 101 | } 102 | 103 | if (item['type'] == "Checkbox") { 104 | listWidget.add(SimpleListCheckbox( 105 | item: item, 106 | onChange: onChange, 107 | position: count, 108 | decorations: widget.decorations, 109 | errorMessages: widget.errorMessages, 110 | validations: widget.validations, 111 | keyboardTypes: widget.keyboardTypes, 112 | )); 113 | } 114 | 115 | if (item['type'] == "Select") { 116 | listWidget.add(SimpleSelect( 117 | item: item, 118 | onChange: onChange, 119 | position: count, 120 | decorations: widget.decorations, 121 | errorMessages: widget.errorMessages, 122 | validations: widget.validations, 123 | keyboardTypes: widget.keyboardTypes, 124 | )); 125 | } 126 | 127 | if (item['type'] == "Date") { 128 | listWidget.add(SimpleDate( 129 | item: item, 130 | onChange: onChange, 131 | position: count, 132 | decorations: widget.decorations, 133 | errorMessages: widget.errorMessages, 134 | validations: widget.validations, 135 | keyboardTypes: widget.keyboardTypes, 136 | )); 137 | } 138 | } 139 | 140 | if (widget.buttonSave != null && widget.actionSave != null) { 141 | listWidget.add(new Container( 142 | margin: EdgeInsets.only(top: 10.0), 143 | child: InkWell( 144 | onTap: () { 145 | if (_formKey.currentState!.validate()) { 146 | widget.actionSave!(formGeneral); 147 | } 148 | }, 149 | child: widget.buttonSave, 150 | ), 151 | )); 152 | } 153 | 154 | return listWidget; 155 | } 156 | 157 | void _handleChanged() { 158 | widget.onChanged(formGeneral); 159 | } 160 | 161 | void onChange(int position, dynamic value) { 162 | this.setState(() { 163 | formGeneral['fields'][position]['value'] = value; 164 | this._handleChanged(); 165 | }); 166 | } 167 | 168 | final _formKey = GlobalKey(); 169 | 170 | @override 171 | Widget build(BuildContext context) { 172 | return Form( 173 | autovalidateMode: 174 | formGeneral['autoValidated'] ?? AutovalidateMode.disabled, 175 | key: _formKey, 176 | child: Container( 177 | padding: EdgeInsets.all(widget.padding ?? 8.0), 178 | child: Column( 179 | crossAxisAlignment: CrossAxisAlignment.stretch, 180 | children: jsonToForm(), 181 | ), 182 | ), 183 | ); 184 | } 185 | } 186 | -------------------------------------------------------------------------------- /lib/json_to_form.dart: -------------------------------------------------------------------------------- 1 | library json_to_form; 2 | 3 | import 'dart:convert'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter/services.dart'; 6 | 7 | class CoreForm extends StatefulWidget { 8 | final String form; 9 | final dynamic formMap; 10 | final EdgeInsets? padding; 11 | final String? labelText; 12 | final ValueChanged onChanged; 13 | final OutlineInputBorder? enabledBorder; 14 | final OutlineInputBorder? errorBorder; 15 | final OutlineInputBorder? disabledBorder; 16 | final OutlineInputBorder? focusedErrorBorder; 17 | final OutlineInputBorder? focusedBorder; 18 | 19 | const CoreForm({ 20 | required this.form, 21 | required this.onChanged, 22 | this.labelText, 23 | this.padding, 24 | this.formMap, 25 | this.enabledBorder, 26 | this.errorBorder, 27 | this.focusedErrorBorder, 28 | this.focusedBorder, 29 | this.disabledBorder, 30 | }); 31 | 32 | @override 33 | _CoreFormState createState() => 34 | new _CoreFormState(formMap ?? json.decode(form)); 35 | } 36 | 37 | class _CoreFormState extends State { 38 | final dynamic formItems; 39 | 40 | int? radioValue; 41 | 42 | List jsonToForm() { 43 | List listWidget = []; 44 | 45 | for (var item in formItems) { 46 | if (item['type'] == "Input" || 47 | item['type'] == "Password" || 48 | item['type'] == "Email" || 49 | item['type'] == "TareaText") { 50 | listWidget.add(new Container( 51 | padding: new EdgeInsets.only(top: 5.0, bottom: 5.0), 52 | child: new Text( 53 | item['title'], 54 | style: new TextStyle(fontWeight: FontWeight.bold, fontSize: 16.0), 55 | ))); 56 | listWidget.add(new TextField( 57 | controller: null, 58 | inputFormatters: item['validator'] != null && item['validator'] != '' 59 | ? [ 60 | if (item['validator'] == 'digitsOnly') 61 | FilteringTextInputFormatter.allow(RegExp('[0-9]')), 62 | if (item['validator'] == 'textOnly') 63 | FilteringTextInputFormatter.allow(RegExp('[a-zA-Z]')) 64 | ] 65 | : null, 66 | decoration: new InputDecoration( 67 | labelText: widget.labelText, 68 | enabledBorder: widget.enabledBorder ?? null, 69 | errorBorder: widget.errorBorder ?? null, 70 | focusedErrorBorder: widget.focusedErrorBorder ?? null, 71 | focusedBorder: widget.focusedBorder ?? null, 72 | disabledBorder: widget.disabledBorder ?? null, 73 | hintText: item['placeholder'] ?? "", 74 | ), 75 | maxLines: item['type'] == "TareaText" ? 10 : 1, 76 | keyboardType: item['keyboardType'] != null 77 | ? item['keyboardType'][item['key']] 78 | : TextInputType.text, 79 | onChanged: (String value) { 80 | item['response'] = value; 81 | _handleChanged(); 82 | }, 83 | obscureText: item['type'] == "Password" ? true : false, 84 | )); 85 | } 86 | 87 | if (item['type'] == "RadioButton") { 88 | listWidget.add(new Container( 89 | margin: new EdgeInsets.only(top: 5.0, bottom: 5.0), 90 | child: new Text(item['title'], 91 | style: new TextStyle( 92 | fontWeight: FontWeight.bold, fontSize: 16.0)))); 93 | radioValue = item['value']; 94 | for (var i = 0; i < item['list'].length; i++) { 95 | listWidget.add( 96 | new Row( 97 | children: [ 98 | new Expanded(child: new Text(item['list'][i]['title'])), 99 | new Radio( 100 | value: item['list'][i]['value'], 101 | groupValue: radioValue, 102 | onChanged: (int? value) { 103 | this.setState(() { 104 | radioValue = value; 105 | item['value'] = value; 106 | _handleChanged(); 107 | }); 108 | }) 109 | ], 110 | ), 111 | ); 112 | } 113 | } 114 | 115 | if (item['type'] == "Switch") { 116 | listWidget.add( 117 | new Row(children: [ 118 | new Expanded(child: new Text(item['title'])), 119 | new Switch( 120 | value: item['switchValue'], 121 | onChanged: (bool value) { 122 | this.setState(() { 123 | item['switchValue'] = value; 124 | _handleChanged(); 125 | }); 126 | }) 127 | ]), 128 | ); 129 | } 130 | 131 | if (item['type'] == "Checkbox") { 132 | listWidget.add(new Container( 133 | margin: new EdgeInsets.only(top: 5.0, bottom: 5.0), 134 | child: new Text(item['title'], 135 | style: new TextStyle( 136 | fontWeight: FontWeight.bold, fontSize: 16.0)))); 137 | for (var i = 0; i < item['list'].length; i++) { 138 | listWidget.add( 139 | new Row( 140 | children: [ 141 | new Expanded(child: new Text(item['list'][i]['title'])), 142 | new Checkbox( 143 | value: item['list'][i]['value'], 144 | onChanged: (bool? value) { 145 | this.setState(() { 146 | item['list'][i]['value'] = value; 147 | _handleChanged(); 148 | }); 149 | }) 150 | ], 151 | ), 152 | ); 153 | } 154 | } 155 | } 156 | return listWidget; 157 | } 158 | 159 | _CoreFormState(this.formItems); 160 | 161 | void _handleChanged() { 162 | widget.onChanged(formItems); 163 | } 164 | 165 | void onChange(int position, dynamic value) { 166 | this.setState(() { 167 | formItems[position]['value'] = value; 168 | _handleChanged(); 169 | }); 170 | } 171 | 172 | @override 173 | Widget build(BuildContext context) { 174 | return Container( 175 | padding: widget.padding ?? EdgeInsets.all(8), 176 | child: Column( 177 | crossAxisAlignment: CrossAxisAlignment.stretch, 178 | children: jsonToForm(), 179 | ), 180 | ); 181 | } 182 | } 183 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: json_to_form 2 | description: The plugin for Flutter converts the JSON format into a custom form. 3 | version: 0.0.5 4 | homepage: https://github.com/VictorRancesCode/json_to_form 5 | 6 | dependencies: 7 | flutter: 8 | sdk: flutter 9 | 10 | dev_dependencies: 11 | flutter_test: 12 | sdk: flutter 13 | 14 | flutter: 15 | 16 | 17 | environment: 18 | sdk: '>=2.12.0 <3.0.0' 19 | flutter: ">=1.17.0" -------------------------------------------------------------------------------- /test/json_to_form_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | 3 | void main() { 4 | test('adds one to input values', () { 5 | //final jsonToForm = new CoreForm(form: null, onChanged: null); 6 | }); 7 | } 8 | --------------------------------------------------------------------------------