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 = xSch_TextFormField_Builder(
      height: null,
      context: context,
      xCol: xCol,
      autoFocus: autoFocus,
      controller: controller,
      label_Visible: label_Visible,
      multiLines: xCol.multilines,
      value: controller != null ? null : item[xCol.colKey],
      maxLines: xCol.multilines ? 4 : 1,
      inputFormatters: inputFormatters,
      editable: xCol.readOnly,
      keyboardType: keyboardType,
      borderColor: widget.xCell_borderColor,
      borderColor_Disabled: widget.xCell_borderColor_Disabled,
      labelColor_Disabled: widget.xCell_labelColor_Disabled,
      onSubmitted: (p0) => xOnXCell_Edit_SubmitValue_INTERNAL(item, xCol, p0),
      onBefore_Edit: () {},
      onChanged: (value) => item[xCol.colKey] = value,
    );
  }
  //WIDGET NEL CASO FOSSE UN DATETIME
  else if (xCol.dataType == DateTime) {
    _widgetForCell = xSch_DateFormField_Builder(
        xCol: xCol,
        onBefore_Edit: () {},
        value: item[xCol.colKey],
        format: xCol.format,
        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 = xSch_TextFormField_Builder(
        context: context,
        selectText: true,
        editable: xCol.readOnly,
        value: controller != null ? null : item[xCol.colKey].toString(),
        xCol: xCol,
        label_Visible: label_Visible,
        maxLines: 1,
        borderColor: widget.xCell_borderColor,
        borderColor_Disabled: widget.xCell_borderColor_Disabled,
        labelColor_Disabled: widget.xCell_labelColor_Disabled,
        height: null,
        autoFocus: autoFocus,
        onBefore_Edit: () {},
        keyboardType: TextInputType.number,
        controller: controller,
        inputFormatters: [FilteringTextInputFormatter.deny(RegExp("[- /,\\\\]"))],
        onSubmitted: (value) => xOnXCell_Edit_SubmitValue_INTERNAL(item, xCol, double.parse(value)),
        onChanged: (value) {
          if (value != "") {
            xOnXCell_Edit_OnChanged(item, xCol, double.parse(value));
            item[xCol.colKey] = double.parse(value);
          } else {
            xOnXCell_Edit_OnChanged(item, xCol, 0.0);
            item[xCol.colKey] = 0.0;
          }
        });
  }
  //WIDGET NEL CASO FOSSE UN INTERO
  else if (xCol.dataType == int) {
    _widgetForCell = xSch_TextFormField_Builder(
      context: context,
      editable: xCol.readOnly,
      selectText: true,
      maxLines: 1,
      label_Visible: label_Visible,
      value: controller != null ? null : item[xCol.colKey].toString(),
      autoFocus: autoFocus,
      height: null,
      xCol: xCol,
      borderColor: widget.xCell_borderColor,
      borderColor_Disabled: widget.xCell_borderColor_Disabled,
      labelColor_Disabled: widget.xCell_labelColor_Disabled,
      keyboardType: TextInputType.number,
      onBefore_Edit: () {},
      onSubmitted: (value) {
        xOnXCell_Edit_SubmitValue_INTERNAL(item, xCol, value);
      },
      controller: controller,
      inputFormatters: [FilteringTextInputFormatter.deny(RegExp("[- /,\\\\]"))],
      onChanged: (value) {
        if (value != "") {
          xOnXCell_Edit_OnChanged(item, xCol, int.parse(value));
          item[xCol.colKey] = int.parse(value);
        } else {
          xOnXCell_Edit_OnChanged(item, xCol, 0);
          item[xCol.colKey] = 0;
        }
      },
    );
  } else {
    return Container(width: 0, height: 0);
  }
  return Container(margin: EdgeInsets.only(top: 2), width: kIsWeb ? xCol.width : null, child: StatefulBuilder(builder: (context, setState) => _widgetForCell));
}