xBuilder_XCell_InEdit method

Widget? xBuilder_XCell_InEdit(
  1. DataGridCell gridCell,
  2. XDataGridRow dataGridRow,
  3. RowColumnIndex rowColumnIndex,
  4. GridColumn column,
  5. CellSubmit submitCell,
)

settare il value in cellInEdit_Value e chiamare submitCell()

Implementation

Widget? xBuilder_XCell_InEdit(DataGridCell gridCell, XDataGridRow dataGridRow, RowColumnIndex rowColumnIndex, GridColumn column, CellSubmit submitCell) {
  if (gridCell.value!.runtimeType == String) {
    return XTextFormField(
        autoFocus: true,
        initialValue: gridCell.value,
        borderVisible: false,
        onChanged: (value) {
          cellInEdit_Value = value;
        },
        onFieldSubmitted: (value) {
          var oldVal = get_ItemPropValue(rowColumnIndex, column);
          print("value:" + value!);
          print("oldVal:" + oldVal);
          if (oldVal != cellInEdit_Value) {
            submitCell();
          }
        });
  } else if (gridCell.value!.runtimeType == DateTime) {
    return DateTimeFormField(
      decoration: InputDecoration(
        labelStyle: XStyles.xStyTextForSubLabel(textColor: Colors.white),
        hintStyle: XStyles.xStyTextForSubLabel(textColor: Colors.white),
        errorStyle: TextStyle(color: Colors.redAccent),
      ),
      onSaved: (date) {
        submitCell();
      },
      onChanged: (value) => cellInEdit_Value = value,
      // onDateSelected: (date) => cellInEdit_Value = date,
      initialValue: gridCell.value,
      dateFormat: DateFormat("dd MMMM yyyy"),
      materialDatePickerOptions: MaterialDatePickerOptions(
        initialEntryMode: DatePickerEntryMode.input,
        initialDatePickerMode: DatePickerMode.year,
      ),
      style: XStyles.xStyTextForSubLabel(textColor: Colors.white),
      mode: DateTimeFieldPickerMode.date,
      autovalidateMode: AutovalidateMode.onUserInteraction,
    );
  } else if (gridCell.value!.runtimeType == double) {
    return Text(gridCell.value.toString(), style: XStyles.xStyTextForSubLabel(textColor: Colors.white));
  } else {
    return Container();
  }
}