xPreview_Dialog method

Future<XFDataItem?> xPreview_Dialog(
  1. XView xView,
  2. dynamic value, {
  3. String? BTNyes_Label,
  4. String? title_Text,
  5. bool autoFocusOfCells = true,
  6. bool isWeb = false,
})

Preview dell'aggiunta di un nuovo Item

Implementation

Future<XFDataItem?> xPreview_Dialog(XView xView, dynamic value, {String? BTNyes_Label, String? title_Text, bool autoFocusOfCells = true, bool isWeb = false}) async {
  xController_Sconto.text = "";
  return await showDialog<XFDataItem?>(
      context: context,
      builder: (context) {
        return StatefulBuilder(builder: (context, setState) {
          var mqc = MediaQuery.of(context).size;
          return Container(
              width: kIsWeb ? MediaQuery.of(context).size.width / 2 : MediaQuery.of(context).size.width - 20,
              alignment: Alignment.center,
              child: SingleChildScrollView(
                  child: XAlertDialog(
                      actionsBTNarea_Padding: EdgeInsets.symmetric(horizontal: 5),
                      content_insetPadding: EdgeInsets.all(3),
                      content_VerticalPadding: 5,
                      // height: MediaQuery.of(context).size.height / 3,
                      width: isWeb ? null : MediaQuery.of(context).size.width - 20,
                      colorBackGround: XSchedaState.color_BackGround_EditDialog,
                      title_Text: title_Text,
                      actionsBTNarea_Child: Container(
                          padding: EdgeInsets.only(bottom: 10),
                          child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [
                            XBtnbase(
                              width: 120,
                              label: "Annulla",
                              label_Style: XStyles.xStyTextForSubLabel(textColor: Colors.red),
                              backGroundColor: Colors.red.withAlpha(60),
                              onPressed: () => Navigator.pop(context, null),
                            ),
                            SizedBox(width: 10),
                            XBtnbase(
                              width: 120,
                              label: "Conferma",
                              label_Style: XStyles.xStyTextForSubLabel(textColor: Colors.green),
                              backGroundColor: Colors.green.withAlpha(60),
                              onPressed: () {
                                editedPage.value = true;
                                xBottomBarAction_Fill();
                                return Navigator.pop(context, value);
                              },
                            ),
                          ])),
                      child: Column(
                          children: xView.cols
                              .groupListsBy((element) => element.originY)
                              .entries
                              .map((e) => Container(
                                    // width: isWeb ? MediaQuery.of(context).size.width / 1.5 : MediaQuery.of(context).size.width - 20,
                                    child: Column(
                                        crossAxisAlignment: CrossAxisAlignment.start,
                                        children: e.value.map(
                                          (e) {
                                            TextEditingController controller = TextEditingController(
                                                text: value[e.colKey].runtimeType != DateTime
                                                    ? value[e.colKey].toString()
                                                    : value[e.colKey] != null
                                                        ? XUtils.dateToString(value[e.colKey], format: "dd/MM/yyyy", noDateLabel: "")
                                                        : XUtils.dateToString(DateTime.now(), format: "dd/MM/yyyy", noDateLabel: ""));
                                            return Container(margin: EdgeInsets.symmetric(vertical: 3), child: xEditDialog_Override_Editor(e.colCaption, value, e, controller, item: value) ?? xEditDialog_CellBuilder(value, e, context, setState, null, label_Visible: true, autoFocus: autoFocusOfCells, keyboardType: TextInputType.text));
                                          },
                                        ).toList()),
                                  ))
                              .toList()))));
        });
      });
}