cmd_AddCliFromExist method

Future cmd_AddCliFromExist(
  1. List liCliente
)

Implementation

Future<dynamic> cmd_AddCliFromExist(List<dynamic> liCliente) async {
  dynamic xclCliente;
  var x = await showDialog<dynamic>(
      context: context,
      builder: (context) {
        return StatefulBuilder(builder: (context, setState) {
          return XAlertDialog(
              title_Text: "Scegli il Cliente tra quelli esistenti:",
              height: null,
              content_VerticalPadding: 30,
              child: XDropSearch<dynamic>(
                dropDownMode: "Dialog",
                al_Title: "",
                al_BackGroundColor: Colors.grey[900],
                itemSelected: xclCliente,
                liItems: liCliente
                    .where((element) =>
                        element.ragSoc!.isNotEmpty || //
                        element.nickName!.isNotEmpty ||
                        element.nome!.isNotEmpty ||
                        element.cognome!.isNotEmpty)
                    .toList(),
                label: "",
                itemAsString: (p0) => p0.nickName!.isNotEmpty
                    ? p0.nickName
                    : p0.ragSoc!.isNotEmpty
                        ? p0.ragSoc
                        : ((p0.nome ?? "") + " " + (p0.cognome ?? "")),
                onChanged_ItemOfDD: (cli) => setState(() => xclCliente = cli),
              ),
              actionsBTNarea_Child: Row(children: [
                Expanded(
                    child: XBtnbase(
                  label: "Annulla",
                  onPressed: () => Navigator.pop(context, null),
                  label_Style: XStyles.xStyTextForSubLabel(textColor: XColors.undo),
                )),
                xclCliente != null
                    ? Expanded(
                        child: XBtnbase(
                        label: "Avanti",
                        onPressed: () => Navigator.pop(context, xclCliente),
                        label_Style: XStyles.xStyTextForSubLabel(textColor: XColors.done),
                      ))
                    : Container()
              ]));
        });
      });
  if (x != null && xclCliente != null) {
    return xclCliente;
  } else {
    return null;
  }
}