xSch_DateFormField_Builder method
Widget
xSch_DateFormField_Builder(
{ - required XCol xCol,
- required dynamic onDateSelected(
- DateTime
)?,
- bool editable = true,
- DateTime? value,
- Color? borderColor,
- Color? borderColor_Disabled,
- Color? labelColor_Disabled,
- dynamic onBefore_Edit()?,
- TextEditingController? controller,
- String? format,
})
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,
String? format,
}) {
OutlineInputBorder o = OutlineInputBorder(borderSide: BorderSide(color: xCol.readOnly.not() ? (borderColor_Active ? xCol.xmodelXprop.col_Color : borderColor ?? Colors.grey[400]!) : (borderColor_Disabled ?? Colors.grey[800]!), width: 1));
return GestureDetector(
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: o,
disabledBorder: o,
enabledBorder: o,
labelText: xCol.colCaption,
constraints: BoxConstraints(maxHeight: 40),
labelStyle: value != null
? XStyles.xStyTextForLabel(xCol.readOnly ? (labelColor_Disabled ?? borderColor_Disabled ?? Colors.grey[900]!) : (labelColor_Disabled ?? borderColor ?? Colors.grey[600]!)) //
: XStyles.xStyTextForDescr(editable.not() ? (labelColor_Disabled ?? borderColor_Disabled ?? Colors.grey[700]!) : (xCol.xmodelXprop.col_Color != Colors.black ? xCol.xmodelXprop.col_Color : XColors.foregroundLight)),
),
enabled: xCol.readOnly.not(),
initialValue: value,
dateFormat: DateFormat(format ?? "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)));
}