CronFormField constructor
CronFormField({
- Key? key,
- TextEditingController? controller,
- Widget? icon,
- String? labelText,
- String? hintText,
- String? dialogTitle,
- String dialogCancelText = 'Cancel',
- String dialogDoneText = 'Done',
- ValueChanged<
String> ? onChanged, - CronExpressionOutputFormat? outputFormat = CronExpressionOutputFormat.AUTO,
- String? initialValue,
- FocusNode? focusNode,
- InputDecoration? decoration,
- TextInputType? keyboardType,
- TextCapitalization textCapitalization = TextCapitalization.none,
- TextInputAction? textInputAction,
- TextStyle? style,
- StrutStyle? strutStyle,
- TextDirection? textDirection,
- TextAlign textAlign = TextAlign.start,
- TextAlignVertical? textAlignVertical,
- bool autofocus = false,
- bool readOnly = false,
- Widget contextMenuBuilder()?,
- bool? showCursor,
- bool obscureText = false,
- bool autocorrect = true,
- SmartDashesType? smartDashesType,
- SmartQuotesType? smartQuotesType,
- bool enableSuggestions = true,
- bool autovalidate = false,
- bool maxLengthEnforced = true,
- int maxLines = 1,
- int? minLines,
- bool expands = false,
- int? maxLength,
- VoidCallback? onEditingComplete,
- ValueChanged<
String> ? onFieldSubmitted, - FormFieldSetter<
String> ? onSaved, - FormFieldValidator<
String> ? validator, - List<
TextInputFormatter> ? inputFormatters, - bool enabled = true,
- double cursorWidth = 2.0,
- Radius? cursorRadius,
- Color? cursorColor,
- Brightness? keyboardAppearance,
- EdgeInsets scrollPadding = const EdgeInsets.all(20.0),
- bool enableInteractiveSelection = true,
- InputCounterWidgetBuilder? buildCounter,
- ScrollPhysics? scrollPhysics,
Creates a CronFormField that contains a TextField.
When a controller is specified, initialValue
must be null (the
default). If controller is null, then a TextEditingController
will be constructed automatically and its text
will be initialized
to initialValue
or the empty string.
For documentation about the various parameters, see the TextField class
and new TextField
, the constructor.
Implementation
CronFormField({
Key? key,
this.controller,
this.icon,
this.labelText,
this.hintText,
this.dialogTitle,
this.dialogCancelText = 'Cancel',
this.dialogDoneText = 'Done',
this.onChanged,
this.outputFormat = CronExpressionOutputFormat.AUTO,
String? initialValue,
FocusNode? focusNode,
InputDecoration? decoration,
TextInputType? keyboardType,
TextCapitalization textCapitalization = TextCapitalization.none,
TextInputAction? textInputAction,
TextStyle? style,
StrutStyle? strutStyle,
TextDirection? textDirection,
TextAlign textAlign = TextAlign.start,
TextAlignVertical? textAlignVertical,
bool autofocus = false,
bool readOnly = false,
Widget Function(BuildContext, EditableTextState)? contextMenuBuilder,
bool? showCursor,
bool obscureText = false,
bool autocorrect = true,
SmartDashesType? smartDashesType,
SmartQuotesType? smartQuotesType,
bool enableSuggestions = true,
bool autovalidate = false,
bool maxLengthEnforced = true,
int maxLines = 1,
int? minLines,
bool expands = false,
int? maxLength,
//GestureTapCallback onTap,
VoidCallback? onEditingComplete,
ValueChanged<String>? onFieldSubmitted,
FormFieldSetter<String>? onSaved,
FormFieldValidator<String>? validator,
List<TextInputFormatter>? inputFormatters,
bool enabled = true,
double cursorWidth = 2.0,
Radius? cursorRadius,
Color? cursorColor,
Brightness? keyboardAppearance,
EdgeInsets scrollPadding = const EdgeInsets.all(20.0),
bool enableInteractiveSelection = true,
InputCounterWidgetBuilder? buildCounter,
ScrollPhysics? scrollPhysics,
}) : assert(initialValue == null || controller == null),
assert(maxLines > 0),
assert(minLines == null || minLines > 0),
assert(
(minLines == null) || (maxLines >= minLines),
"minLines can't be greater than maxLines",
),
assert(
!expands || minLines == null,
'minLines and maxLines must be null when expands is true.',
),
assert(
!obscureText || maxLines == 1,
'Obscured fields cannot be multiline.',
),
assert(maxLength == null || maxLength > 0),
super(
key: key,
initialValue:
controller != null ? controller.text : (initialValue ?? ''),
onSaved: onSaved,
validator: validator,
// autovalidate: autovalidate,
enabled: enabled,
builder: (FormFieldState<String> formFieldState) {
final CronFormFieldState state =
formFieldState as CronFormFieldState;
final InputDecoration effectiveDecoration = decoration ??
InputDecoration(
labelText: labelText,
icon: icon,
hintText: hintText,
suffixIcon: const Icon(Icons.arrow_drop_down),
);
effectiveDecoration.applyDefaults(
Theme.of(state.context).inputDecorationTheme,
);
return TextField(
controller: state._controller,
focusNode: focusNode,
decoration: effectiveDecoration.copyWith(
errorText: state.errorText,
),
keyboardType: keyboardType,
textInputAction: textInputAction,
style: style,
strutStyle: strutStyle,
textAlign: textAlign,
textAlignVertical: textAlignVertical,
textDirection: textDirection,
textCapitalization: textCapitalization,
autofocus: autofocus,
contextMenuBuilder: contextMenuBuilder,
readOnly: true,
showCursor: showCursor,
obscureText: obscureText,
autocorrect: autocorrect,
smartDashesType: smartDashesType ??
(obscureText
? SmartDashesType.disabled
: SmartDashesType.enabled),
smartQuotesType: smartQuotesType ??
(obscureText
? SmartQuotesType.disabled
: SmartQuotesType.enabled),
enableSuggestions: enableSuggestions,
// maxLengthEnforced: maxLengthEnforced,
maxLines: maxLines,
minLines: minLines,
expands: expands,
maxLength: maxLength,
onChanged: state.onChangedHandler,
onTap: readOnly ? null : state._showCronFormFieldDialog,
onEditingComplete: onEditingComplete,
onSubmitted: onFieldSubmitted,
inputFormatters: inputFormatters,
enabled: enabled,
cursorWidth: cursorWidth,
cursorRadius: cursorRadius,
cursorColor: cursorColor,
scrollPadding: scrollPadding,
scrollPhysics: scrollPhysics,
keyboardAppearance: keyboardAppearance,
enableInteractiveSelection: enableInteractiveSelection,
buildCounter: buildCounter,
);
},
);