builderEntryDialog_BTNs method

XBtnbase builderEntryDialog_BTNs(
  1. TextEditingController controller,
  2. String valueAndLabel,
  3. bool isSconto,
  4. void parentSetState(
    1. void ()
    ), {
  5. XCol? xCol,
})

Implementation

XBtnbase builderEntryDialog_BTNs(TextEditingController controller, String valueAndLabel, bool isSconto, void Function(void Function()) parentSetState, {XCol? xCol}) {
  return XBtnbase(
      width: 40,
      height: 40,
      label_Style: XStyles.xStyTextForSubLabel(valueAndLabel.contains("+")
          ? Colors.green
          : valueAndLabel.contains("-") || valueAndLabel == ("C")
              ? Colors.red
              : Colors.green),
      label: valueAndLabel,
      backGroundColor: Colors.grey[800],
      onPressed: () {
        if (valueAndLabel == "C") {
          controller.text = "";
          FocusScope.of(context).unfocus();
        } else {
          if (isSconto) {
            parentSetState(() {
              controller.text += calcSconto(controller, valueAndLabel);
            });
          } else {
            if (valueAndLabel.contains("-")) {
              calcCell_Negative(xCol!, controller, int.parse(valueAndLabel.replaceFirst("-", "")));
            } else {
              calcCell_Positive(xCol!, controller, int.parse(valueAndLabel.replaceFirst("+", "")));
            }
          }
          controller.selection = TextSelection(baseOffset: controller.text.length, extentOffset: controller.text.length);
        }
      });
}