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 != null && element.ragSoc!.isNotEmpty) || //
                        (element.nickName != null && element.nickName!.isNotEmpty) ||
                        (element.nome != null && element.nome!.isNotEmpty) ||
                        (element.cognome != null && element.cognome!.isNotEmpty))
                    .toList(),
                label: "",
                itemAsString: (p0) => p0.nickName != null && p0.nickName!.isNotEmpty
                    ? p0.nickName
                    : p0.ragSoc != null && 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;
  }
}