fieldToFormField function

Widget fieldToFormField(
  1. Field args,
  2. GlobalKey<FormBuilderState> key,
  3. ValueChanged onChanged
)

Implementation

Widget fieldToFormField(
    Field args, GlobalKey<FormBuilderState> key, ValueChanged onChanged) {
  return Padding(
    padding: const EdgeInsets.fromLTRB(12, 4, 12, 4),
    child: FormBuilderTextField(
      attribute: args.attribute,
      onChanged: (v) {
        save(args.attribute, v);
        print('saving $v');
        if (isNonNull(onChanged)) {
          onChanged(v);
        }
        throw 'onchange null';
      },
      keyboardType: args.keyboardType,
      obscureText: args.obscureText,
      decoration: new InputDecoration(
        labelText: args.labelText,
        contentPadding: EdgeInsets.fromLTRB(4, 0, 4, 0),
        fillColor: Colors.white,
        border: new OutlineInputBorder(
          borderRadius: new BorderRadius.circular(10.0),
          borderSide: new BorderSide(),
        ),
        //fillColor: Colors.green
      ),
      validators: [args.validate],
    ),
  );
}