xPreview_Dialog method
Preview dell'aggiunta di un nuovo Item
Implementation
Future<bool> xPreview_Dialog(XView xView, dynamic value, {String? BTNyes_Label, String? title_Text, bool autoFocusOfCells = false, bool isWeb = false}) async {
xController_Sconto.text = "";
return null !=
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: () {
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(
(t) {
TextEditingController controller = TextEditingController(
text: value[t.colKey].runtimeType != DateTime
? value[t.colKey] == null
? ""
: value[t.colKey].toString()
: value[t.colKey] != null
? XUtils.dateToString(value[t.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(t.colCaption, value, t, controller, item: value) ?? //
xEditDialog_CellBuilder(value, t, context, setState, controller, label_Visible: true, autoFocus: e.value.first.colKey == t.colKey ? true : autoFocusOfCells, keyboardType: TextInputType.text),
);
},
).toList()),
))
.toList()))));
});
});
}