DateTextField constructor
DateTextField({
- Key? key,
- AdeptValueController<
DateTime> ? controller, - FocusNode? focusNode,
- InputDecoration decoration = const InputDecoration(),
- TextInputType? keyboardType,
- TextInputAction? textInputAction,
- TextCapitalization textCapitalization = TextCapitalization.none,
- TextStyle? style,
- TextAlign textAlign = TextAlign.start,
- TextDirection? textDirection,
- bool autofocus = false,
- bool obscureText = false,
- bool autocorrect = true,
- int maxLines = 1,
- int? maxLength,
- bool maxLengthEnforced = true,
- ValueChanged<
String> ? onChanged, - VoidCallback? onEditingComplete,
- ValueChanged<
String> ? onSubmitted, - List<
TextInputFormatter> ? inputFormatters, - bool? enabled,
- double cursorWidth = 2.0,
- Radius? cursorRadius,
- Color? cursorColor,
- Brightness? keyboardAppearance,
- EdgeInsets scrollPadding = const EdgeInsets.all(20.0),
- bool enableInteractiveSelection = true,
- GestureTapCallback? onTap,
- VoidCallback? clearButtonAction,
- Color? clearButtonColor,
- IconData? clearButtonIcon,
- bool autoUpdateDecoration = true,
- DateTimePickerMode dateTimePickerMode = DateTimePickerMode.BOTH,
- String? dateFormat,
- DateTime? defaultDate,
- OnDateTimeSelected? onDateTimeSelected,
Implementation
DateTextField({
this.key,
this.controller,
this.focusNode,
this.decoration = const InputDecoration(),
this.keyboardType,
this.textInputAction,
this.textCapitalization = TextCapitalization.none,
this.style,
this.textAlign = TextAlign.start,
this.textDirection,
this.autofocus = false,
this.obscureText = false,
this.autocorrect = true,
this.maxLines = 1,
this.maxLength,
this.maxLengthEnforced = true,
this.onChanged,
this.onEditingComplete,
this.onSubmitted,
this.inputFormatters,
this.enabled,
this.cursorWidth = 2.0,
this.cursorRadius,
this.cursorColor,
this.keyboardAppearance,
this.scrollPadding = const EdgeInsets.all(20.0),
this.enableInteractiveSelection = true,
this.onTap,
this.clearButtonAction,
this.clearButtonColor,
this.clearButtonIcon,
this.autoUpdateDecoration = true,
this.dateTimePickerMode = DateTimePickerMode.BOTH,
this.dateFormat,
this.defaultDate,
this.onDateTimeSelected,
}) {
enabled ??= true;
dateFormat ??= DATE_FORMAT;
textController ??= TextEditingController();
controller ??= AdeptValueController(value: defaultDate);
if (controller!.value != null) {
textController!.text = AdeptDateTime(dateAsDateTime: controller!.value)
.format(format: dateFormat);
}
}