forms_library 1.0.3+3 copy "forms_library: ^1.0.3+3" to clipboard
forms_library: ^1.0.3+3 copied to clipboard

outdated

A flutter package wich transform a json into a flutter form.

forms_library #

A new Flutter package, send a valid json and receive a rendered form.

Getting Started #

This project is a starting point for a Flutter application. The library was created to render and handle custom forms through a particular json

Library Install #

Add the last version of the library to your pubspect.yaml file

dependencies: ... forms_library: ^1..

Library Structure #

For the correct functioning of the library it is necessary to send it at least a valid json wich contain the fields in the following format:

[
  {
    "id": "", //field id unique
    "idProducto": "", 
    "orden": "0",
    "tipo": "5", //field type
    "editable": "1", //1 to allow users to edit field or 0 to not allow edits
    "validacion": ^[\\s\\S]+$",//regex expr to validate received data
    "valorDefecto": "",
    "visible": "1", 
    "dependeDe": "",
    "claveDependencia": "",
    "etiqueta": "", //name displayed on the field
    "campoProtocolo": "4",
    "etiquetaProtocolo": "",
    "pantallaAyuda": "",
    "descripcion": "",
    "tamMax": "", //max lenght
    "postTransaccion": "0"
  },
  {
    "id": "",
    "idProducto": "",
    "orden": "1",
    "tipo": "8",
    "editable": "1",
    "validacion": "^[\\s\\S]+$", 
    "valorDefecto": "",
    "visible": "1",
    "dependeDe": "",
    "claveDependencia": "",
    "etiqueta": "Nombre",
    "campoProtocolo": "3",
    "etiquetaProtocolo": "nombre",
    "pantallaAyuda": "",
    "descripcion": "",
    "tamMax": "",
    "postTransaccion": "0"
  }
  ......
]

Type of fields allowed #

Depends on the 'type' value sent on the json, it will render a different field:

**Type '1': FieldType.select**

    ```{
    "id":"55504",
    "idProducto":"555",
    "orden":"6",
    "tipo":"1",
    "editable":"1",
    "validacion":"^[\\s\\S]+$",
    "valorDefecto":"",
    "visible":"1",
    "dependeDe":"",
    "claveDependencia":"",
    "etiqueta":"Tipo documento",
    "campoProtocolo":"3",
    "etiquetaProtocolo":"id_tipoDocumento",
    "pantallaAyuda":"",
    "descripcion":"",
    "tamMax":"",
    "postTransaccion":"0"
    }```
    ![Example select](https://i.imgur.com/CDuAo50.png)
    ![Example select expanded](https://i.imgur.com/bwdbkAn.png)


**Type '2': FieldType.input**


case '3':
  return FieldType.checkbox;
case '4':
  return FieldType.date;
case '5':
  return FieldType.separator;
case '6':
  return FieldType.productAmounts;
case '7':
  return FieldType.checkboxTyc;
case '8':
  return FieldType.inputAlpha;
case '12':
  return FieldType.barCode;
case '13':
  return FieldType.nfcCommand;
case '15':
  return FieldType.biometric;
case '16':
  return FieldType.selectPlus;
case '17':
  return FieldType.redirection;
case '19':
  return FieldType.inputMulti;
case '20':
  return FieldType.qrCode;
case '21':
  return FieldType.inputSecure;
case '22':
  return FieldType.label;
case '23':
  return FieldType.selectMulti;
case '24':
  return FieldType.combinations;
case '25':
  return FieldType.dynamic;







For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.