DateTextField constructor

DateTextField({
  1. Key? key,
  2. AdeptValueController<DateTime>? controller,
  3. FocusNode? focusNode,
  4. InputDecoration decoration = const InputDecoration(),
  5. TextInputType? keyboardType,
  6. TextInputAction? textInputAction,
  7. TextCapitalization textCapitalization = TextCapitalization.none,
  8. TextStyle? style,
  9. TextAlign textAlign = TextAlign.start,
  10. TextDirection? textDirection,
  11. bool autofocus = false,
  12. bool obscureText = false,
  13. bool autocorrect = true,
  14. int maxLines = 1,
  15. int? maxLength,
  16. bool maxLengthEnforced = true,
  17. ValueChanged<String>? onChanged,
  18. VoidCallback? onEditingComplete,
  19. ValueChanged<String>? onSubmitted,
  20. List<TextInputFormatter>? inputFormatters,
  21. bool? enabled,
  22. double cursorWidth = 2.0,
  23. Radius? cursorRadius,
  24. Color? cursorColor,
  25. Brightness? keyboardAppearance,
  26. EdgeInsets scrollPadding = const EdgeInsets.all(20.0),
  27. bool enableInteractiveSelection = true,
  28. GestureTapCallback? onTap,
  29. VoidCallback? clearButtonAction,
  30. Color? clearButtonColor,
  31. IconData? clearButtonIcon,
  32. bool autoUpdateDecoration = true,
  33. DateTimePickerMode dateTimePickerMode = DateTimePickerMode.BOTH,
  34. String? dateFormat,
  35. DateTime? defaultDate,
  36. 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);
  }
}