xSch_DateFormField_Builder method
Implementation
Widget xSch_DateFormField_Builder({
required XCol xCol,
required Function(DateTime)? onDateSelected,
bool editable = true,
DateTime? value,
Color? borderColor,
Color? borderColor_Disabled,
Color? labelColor_Disabled,
Function()? onBefore_Edit,
TextEditingController? controller,
}) {
return GestureDetector(
// onTap: () {
// onBefore_Edit!();
// },
child: DateTimeFormField(
decoration: InputDecoration(
contentPadding: EdgeInsets.only(right: 2, top: 2, bottom: 2, left: 4),
hintStyle: XStyles.xStyleText(fontSize: 15, colorText: XSchedaState.color_HintText),
errorStyle: TextStyle(color: Colors.redAccent),
border: OutlineInputBorder(borderSide: BorderSide(color: xCol.readOnly.not() ? (borderColor ?? Colors.grey[600]!) : (borderColor_Disabled ?? Colors.grey[700]!), width: 1)),
disabledBorder: OutlineInputBorder(borderSide: BorderSide(color: xCol.readOnly.not() ? (borderColor ?? Colors.grey[600]!) : (borderColor_Disabled ?? Colors.grey[700]!), width: 1)),
enabledBorder: OutlineInputBorder(borderSide: BorderSide(color: xCol.readOnly.not() ? (borderColor ?? Colors.grey[600]!) : (borderColor_Disabled ?? Colors.grey[700]!), width: 1)),
labelText: xCol.colCaption,
constraints: BoxConstraints(maxHeight: 35),
labelStyle: value != null ? XStyles.xStyTextForLabel(xCol.readOnly ? (labelColor_Disabled ?? borderColor_Disabled ?? Colors.grey[700]!) : (labelColor_Disabled ?? borderColor ?? Colors.grey[600]!)) : XStyles.xStyTextForDescr(editable.not() ? (labelColor_Disabled ?? borderColor_Disabled ?? Colors.grey[700]!) : (labelColor_Disabled ?? borderColor ?? Colors.grey[600]!)),
),
enabled: xCol.readOnly.not(),
initialValue: value,
dateFormat: DateFormat("dd/MM/yy"),
dateTextStyle: XStyles.xStyleText(fontSize: 15, colorText: Colors.white),
initialEntryMode: DatePickerEntryMode.calendar,
initialDatePickerMode: DatePickerMode.day,
mode: DateTimeFieldPickerMode.date,
autovalidateMode: AutovalidateMode.onUserInteraction,
validator: (e) => (e?.day ?? 0) == 1 ? 'Perfavore sistema la data' : null,
onDateSelected: (value) => onDateSelected!(value)));
}