fetch_json_pages 0.0.2
fetch_json_pages: ^0.0.2 copied to clipboard
Using this package you can directly render page which uses json_dynamic_widget
This version is supported for new version Using this package you can directly render page using navigator.push , as input you have to pass json string as shown in the below example
##Example
String screen =
await rootBundle.loadString('assets/json/screen.json');
navigatorKey.currentState?.push(MaterialPageRoute(
builder: (context) =>
renderingPage(jsonString: screen),
));
<!-- assets/json/screen.json -->
{
"type": "scaffold",
"args": {
"appBar": {
"type": "app_bar",
"args": {
"title": {
"type": "text",
"args": {
"text": "Sign Up",
"style": {
"color": "#000000",
"fontWeight": "bold"
}
}
},
"backgroundColor": "#1569C7"
}
},
"body": {
"type": "single_child_scroll_view",
"args": {
"child": {
"type": "column",
"args": {
"children": [
{
"type": "container",
"args": {
"padding": [
20,
20,
20,
20
],
"child": {
"type": "safe_area",
"args": {
"child": {
"type": "form",
"args": {
"child": {
"type": "column",
"args": {
"crossAxisAlignment": "center",
"mainAxisAlignment": "center",
"children": [
{
"type": "row",
"args": {
"children": [
{
"type": "asset_image",
"args": {
"height": 30,
"width": 30,
"name": "assets/images/Prefix_mobile.png"
}
},
{
"type": "sized_box",
"args": {
"width": 10
}
},
{
"type": "expanded",
"args": {
"child": {
"type": "stack",
"args": {
"children": [
{
"type": "text_form_field",
"id": "password",
"args": {
"keyboardType": "number",
"controller": "${text1FieldController}",
"obscureText": "true",
"decoration": {
"labelText": "Enter your PIN",
"labelStyle": {
"color": "#1569C7",
"fontWeight": "bold",
"fontSize": 15
}
}
}
},
{
"type": "positioned",
"args": {
"right": 0,
"bottom": 10,
"child": {
"type": "row",
"args": {
"mainAxisSize": "min",
"children": [
{
"type": "asset_image",
"args": {
"height": 30,
"width": 30,
"name": "assets/images/eyeon.png"
}
}
]
}
}
}
}
]
}
}
}
}
]
}
},
{
"type": "sized_box",
"args": {
"height": 40
}
},
{
"type": "elevated_button",
"args": {
"child": {
"type": "text",
"args": {
"text": "Login",
"style": {
"color": "#FFFFFF"
}
}
},
"style": {
"backgroundColor": "#1569C7"
},
"onPressed": "${pin('form_context')}"
}
}
]
}
}
}
}
}
}
}
}
]
}
}
}
}
}
}