xEditDialog_CellBuilder method

Container xEditDialog_CellBuilder(
  1. XFDataItem item,
  2. XCol xCol,
  3. BuildContext context,
  4. void setState(
    1. void ()
    ),
  5. TextEditingController controller, {
  6. TextInputType? keyboardType,
  7. bool autoFocus = true,
  8. bool label_Visible = false,
  9. List<TextInputFormatter>? inputFormatters,
})

CellBuilder dellxEntry

Implementation

Container xEditDialog_CellBuilder(XFDataItem item, XCol xCol, BuildContext context, void Function(void Function()) setState, TextEditingController controller, {TextInputType? keyboardType, bool autoFocus = true, bool label_Visible = false, List<TextInputFormatter>? inputFormatters}) {
  Widget _widgetForCell = Container();
  //WIDGET NEL CASO FOSSE UNA STRING
  if (xCol.dataType == String && xCol.colKey.startsWith("li").not()) {
    _widgetForCell = xLayout_TextFormField_Builder(
      height: null,
      context: context,
      xCol: xCol,
      autoFocus: autoFocus,
      controller: controller,
      label_Visible: label_Visible,
      multiLines: xCol.multilines,
      maxLines: xCol.multilines ? 4 : 1,
      inputFormatters: inputFormatters,
      editable: xCol.readOnly,
      keyboardType: keyboardType,
      borderColor: xCellEditable_borderColor,
      borderColor_Disabled: xCellEditable_borderColor_Disabled,
      labelColor_Disabled: xCellEditable_labelColor_Disabled,
      onSubmitted: (p0) => xOnXCell_Edit_SubmitValue_INTERNAL(item, xCol, p0),
      onBefore_Edit: null,
      onChanged: (value) => item[xCol.colKey] = value,
    );
  }
  //WIDGET NEL CASO FOSSE UN DATETIME
  else if (xCol.dataType == DateTime) {
    DateTime? dt;
    if (controller.text != "") dt = DateTime.parse(controller.text);
    _widgetForCell = xLayout_DateFormField_Builder(
        xCol: xCol,
        onBefore_Edit: () {},
        value: dt == DateTime(1900, 01, 01) ? null : dt,
        onDateSelected: (value) {
          item[xCol.colKey] = value;
          // xOnXCell_Edit_SubmitValue_INTERNAL(item, xCol, value);
        });
  }
  //WIDGET NEL CASO FOSSE UN DOUBLE
  else if (xCol.dataType == double) {
    _widgetForCell = xLayout_TextFormField_Builder(
        context: context,
        selectText: true,
        editable: xCol.readOnly,
        xCol: xCol,
        label_Visible: label_Visible,
        maxLines: 1,
        borderColor: xCellEditable_borderColor,
        borderColor_Disabled: xCellEditable_borderColor_Disabled,
        labelColor_Disabled: xCellEditable_labelColor_Disabled,
        height: null,
        autoFocus: autoFocus,
        onBefore_Edit: null,
        keyboardType: TextInputType.number,
        controller: controller,
        inputFormatters: [FilteringTextInputFormatter.deny(RegExp("[- /,\\\\]"))],
        onSubmitted: (value) => xOnXCell_Edit_SubmitValue_INTERNAL(item, xCol, double.parse(value)),
        onChanged: (value) {
          if (value != "")
            item[xCol.colKey] = double.parse(value);
          // xOnXCell_Edit_OnChanged(item, xCol, double.parse(value));
          else
            item[xCol.colKey] = 0.0;
        });
  }
  //WIDGET NEL CASO FOSSE UN INTERO
  else if (xCol.dataType == int) {
    _widgetForCell = xLayout_TextFormField_Builder(
      context: context,
      editable: xCol.readOnly,
      selectText: true,
      maxLines: 1,
      label_Visible: label_Visible,
      autoFocus: autoFocus,
      height: null,
      xCol: xCol,
      borderColor: xCellEditable_borderColor,
      borderColor_Disabled: xCellEditable_borderColor_Disabled,
      labelColor_Disabled: xCellEditable_labelColor_Disabled,
      keyboardType: TextInputType.number,
      onBefore_Edit: null,
      onSubmitted: (value) => xOnXCell_Edit_SubmitValue_INTERNAL(item, xCol, value),
      controller: controller,
      // value: controller.text == "0.0" ? "" : controller.text,
      inputFormatters: [FilteringTextInputFormatter.deny(RegExp("[- /,\\\\]"))],
      onChanged: (value) {
        if (value != "")
          item[xCol.colKey] = int.parse(value);
        else
          item[xCol.colKey] = 0.0;
      },
    );
  } else
    return Container(width: 0, height: 0);

  return Container(
      width: xCol.width,
      child: StatefulBuilder(builder: (context, setState) {
        return _widgetForCell;
      }));
  //}
}