calcCell_Negative function

dynamic calcCell_Negative(
  1. XCol xCol,
  2. TextEditingController controller,
  3. dynamic numForCalc
)

Implementation

calcCell_Negative(XCol xCol, TextEditingController controller, numForCalc) {
  var x;
  if (controller.text == "") {
  } else {
    if (xCol.dataType == double) {
      x = double.parse(controller.text);
      if (x > 0) {
        var res = (x - numForCalc);
        if (res < 0) {
        } else {
          controller.text = res.toString();
        }
      }
    } else if (xCol.dataType == int) {
      x = int.parse(controller.text);
      if (x > 0) {
        var res = (x - numForCalc);
        if (res < 0) {
        } else {
          controller.text = res.toString();
        }
      }
    } else {
      x = int.parse(controller.text);
      if (x > 0) {
        var res = (x - numForCalc);
        if (res < 0) {
        } else {
          controller.text = res.toString();
        }
      }
    }
  }

  return x;
}